Restrict git describe to tags matching v*
[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 scaling-type {
263           description
264               "Type of scaling";
265           type manotypes:scaling-policy-type;
266         }
267
268         leaf enabled {
269           description
270             "Specifies if the scaling policy can be applied";
271           type boolean;
272           default true;
273         }
274
275         leaf scale-in-operation-type {
276           description
277               "Operation to be applied to check between scaling criterias to
278                check if the scale in threshold condition has been met.
279                Defaults to AND";
280           type manotypes:scaling-criteria-operation;
281           default AND;
282         }
283
284         leaf scale-out-operation-type {
285           description
286               "Operation to be applied to check between scaling criterias to
287                check if the scale out threshold condition has been met.
288                Defauls to OR";
289           type manotypes:scaling-criteria-operation;
290           default OR;
291         }
292
293         leaf threshold-time {
294           description
295             "The duration for which the criteria must hold true";
296           type uint32;
297           mandatory true;
298         }
299
300         leaf cooldown-time {
301           description
302             "The duration after a scaling-in/scaling-out action has been
303             triggered, for which there will be no further optional";
304           type uint32;
305           mandatory true;
306         }
307
308         list scaling-criteria {
309           description
310               "list of conditions to be met for generating scaling
311                  requests";
312           key "name";
313
314           leaf name {
315             type string;
316           }
317
318           leaf scale-in-threshold {
319             description
320                 "Value below which scale-in requests are generated";
321             type uint64;
322           }
323
324           leaf scale-in-relational-operation {
325             description
326               "The relational operator used to compare the monitoring param
327               against the scale-in-threshold.";
328             type manotypes:relational-operation-type;
329             default LE;
330           }
331
332           leaf scale-out-threshold {
333             description
334                 "Value above which scale-out requests are generated";
335             type uint64;
336           }
337
338           leaf scale-out-relational-operation {
339             description
340               "The relational operator used to compare the monitoring param
341               against the scale-out-threshold.";
342             type manotypes:relational-operation-type;
343             default GE;
344           }
345
346           leaf ns-monitoring-param-ref {
347             description
348                "Reference to the NS level monitoring parameter
349                 that is aggregated";
350             type leafref {
351               path "../../../../monitoring-param/id";
352             }
353           }
354         }
355       }
356
357       list vnfd-member {
358         description "List of VNFs in this scaling group";
359         key "member-vnf-index-ref";
360
361         leaf member-vnf-index-ref {
362           description "member VNF index of this member VNF";
363           type leafref {
364             path "../../../constituent-vnfd/member-vnf-index";
365           }
366         }
367
368         leaf count {
369           description
370             "count of this member VNF  within this scaling group.
371              The count allows to define  the number of instances
372              when a scaling action targets this scaling group";
373           type uint32;
374           default 1;
375         }
376       }
377
378       leaf min-instance-count {
379         description
380           "Minimum instances of the scaling group which are allowed.
381           These instances are created by default when the network service
382           is instantiated.";
383         type uint32;
384         default 0;
385       }
386
387       leaf max-instance-count {
388         description
389           "Maximum instances of this scaling group that are allowed
390            in a single network service. The network service scaling
391            will fail, when the number of service group instances
392            exceed the max-instance-count specified.";
393         type uint32;
394         default 10;
395       }
396
397       list scaling-config-action {
398         description "List of scaling config actions";
399         key "trigger";
400
401         leaf trigger {
402           description "scaling trigger";
403           type manotypes:scaling-trigger;
404         }
405
406         leaf ns-service-primitive-name-ref {
407           description "Reference to the NS service primitive";
408           type leafref {
409             path "../../../service-primitive/name";
410           }
411         }
412       }
413     }
414
415
416     list vnffgd {
417       description
418           "List of VNF Forwarding Graph Descriptors (VNFFGD).";
419
420       key "id";
421
422       leaf id {
423         description
424             "Identifier for the VNFFGD.";
425         type string;
426       }
427
428       leaf name {
429         description
430             "VNFFGD name.";
431         type string;
432       }
433
434       leaf short-name {
435         description
436             "Short name to appear as label in the UI";
437         type string;
438       }
439
440       leaf vendor {
441         description "Provider of the VNFFGD.";
442         type string;
443       }
444
445       leaf description {
446         description "Description of the VNFFGD.";
447         type string;
448       }
449
450       leaf version {
451         description "Version of the VNFFGD";
452         type string;
453       }
454
455       list rsp {
456         description
457           "List of Rendered Service Paths (RSP).";
458
459         key "id";
460
461         leaf id {
462           description
463             "Identifier for the RSP.";
464           type string;
465         }
466
467         leaf name {
468           description
469             "RSP name.";
470           type string;
471         }
472
473         list vnfd-connection-point-ref {
474           description
475             "A list of references to connection points.";
476           key "member-vnf-index-ref";
477
478           leaf member-vnf-index-ref {
479             description "Reference to member-vnf within constituent-vnfds";
480             type leafref {
481               path "../../../../constituent-vnfd/member-vnf-index";
482             }
483           }
484
485           leaf order {
486             type uint8;
487             description
488               "A number that denotes the order of a VNF in a chain";
489           }
490
491           leaf vnfd-id-ref {
492             description
493               "A reference to a vnfd. This is a
494                   leafref to path:
495                       ../../../../nsd:constituent-vnfd
496                       + [nsd:id = current()/../nsd:id-ref]
497                       + /nsd:vnfd-id-ref";
498
499              type leafref {
500                 path "../../../../constituent-vnfd" +
501                      "[member-vnf-index = current()/../member-vnf-index-ref]" +
502                      "/vnfd-id-ref";
503              }
504            }
505
506           leaf vnfd-connection-point-ref {
507             description
508               "A reference to a connection point name
509                   in a vnfd. This is a leafref to path:
510                       /vnfd:vnfd-catalog/vnfd:vnfd
511                       + [vnfd:id = current()/../nsd:vnfd-id-ref]
512                       + /vnfd:connection-point/vnfd:name
513                   NOTE: An issue with confd is preventing the
514                   use of xpath. Seems to be an issue with leafref
515                   to leafref, whose target is in a different module.
516                   Once that is resolved this will switched to use
517                   leafref";
518             // TODO: Keeping as string as this needs to be
519             // diffenent lvel based of if it is nsd-catalog or
520             // in nsr.
521             // type leafref {
522             //   path "../../../../../../vnfd:vnfd-catalog/vnfd:vnfd" +
523             //        "[vnfd:id = current()/../vnfd-id-ref]/" +
524             //        "vnfd:connection-point/vnfd:name";
525             // }
526             type string;
527           }
528         }
529       } //rsp
530
531       list classifier {
532         description
533             "List of classifier rules.";
534
535         key "id";
536
537         leaf id {
538           description
539               "Identifier for the classifier rule.";
540           type string;
541         }
542
543         leaf name {
544           description
545               "Name of the classifier.";
546           type string;
547         }
548
549         leaf rsp-id-ref {
550           description
551               "A reference to the RSP.";
552           type leafref {
553             path "../../rsp/id";
554           }
555         }
556
557         leaf member-vnf-index-ref {
558           description "Reference to member-vnf within constituent-vnfds";
559           type leafref {
560             path "../../../constituent-vnfd/member-vnf-index";
561           }
562         }
563
564         leaf vnfd-id-ref {
565           description
566               "A reference to a vnfd. This is a
567                   leafref to path:
568                       ../../../nsd:constituent-vnfd
569                       + [nsd:id = current()/../nsd:id-ref]
570                       + /nsd:vnfd-id-ref";
571
572           type leafref {
573               path "../../../constituent-vnfd" +
574                    "[member-vnf-index = current()/../member-vnf-index-ref]" +
575                    "/vnfd-id-ref";
576           }
577         }
578
579         leaf vnfd-connection-point-ref {
580           description
581               "A reference to a connection point name
582                   in a vnfd. This is a leafref to path:
583                       /vnfd:vnfd-catalog/vnfd:vnfd
584                       + [vnfd:id = current()/../nsd:vnfd-id-ref]
585                       + /vnfd:connection-point/vnfd:name
586                   NOTE: An issue with confd is preventing the
587                   use of xpath. Seems to be an issue with leafref
588                   to leafref, whose target is in a different module.
589                   Once that is resolved this will switched to use
590                   leafref";
591           // TODO: Keeping as string as this needs to be
592           // diffenent lvel based of if it is nsd-catalog or
593           // in nsr.
594           // type leafref {
595           //     path "../../../../../vnfd:vnfd-catalog/vnfd:vnfd" +
596           //          "[vnfd:id = current()/../vnfd-id-ref]/" +
597           //          "vnfd:connection-point/vnfd:name";
598           // }
599           type string;
600         }
601
602         list match-attributes {
603           description
604               "List of match attributes.";
605
606           key "id";
607
608           leaf id {
609             description
610                 "Identifier for the classifier match attribute rule.";
611             type string;
612           }
613
614           leaf ip-proto {
615             description
616                 "IP Protocol.";
617             type uint8;
618           }
619
620           leaf source-ip-address {
621             description
622                 "Source IP address.";
623             type inet:ip-address;
624           }
625
626           leaf destination-ip-address {
627             description
628                 "Destination IP address.";
629             type inet:ip-address;
630           }
631
632           leaf source-port {
633             description
634                 "Source port number.";
635             type inet:port-number;
636           }
637
638           leaf destination-port {
639             description
640                 "Destination port number.";
641             type inet:port-number;
642           }
643           //TODO: Add more match criteria
644         } //match-attributes
645       } // classifier
646     } // vnffgd
647
648     uses manotypes:ip-profile-list;
649
650     list initial-service-primitive {
651       description
652         "Initial set of service primitives for NSD.";
653       key "seq";
654
655       uses manotypes:event-config;
656     }
657
658     list terminate-service-primitive {
659       description
660         "Set of service primitives during
661          termination for NSD.";
662       key "seq";
663
664       uses manotypes:event-config;
665     }
666
667     uses manotypes:input-parameter-xpath;
668
669     list parameter-pool {
670       description
671         "Pool of parameter values which must be
672          pulled from during configuration";
673       key "name";
674
675       leaf name {
676         description
677             "Name of the configuration value pool";
678         type string;
679       }
680
681       container range {
682         description
683             "Create a range of values to populate the pool with";
684
685         leaf start-value {
686           description
687               "Generated pool values start at this value";
688           type uint32;
689           mandatory true;
690         }
691
692         leaf end-value {
693           description
694               "Generated pool values stop at this value";
695           type uint32;
696           mandatory true;
697         }
698       }
699     }
700
701     list key-pair {
702       key "name";
703       description "Used to configure the list of public keys to be injected as part
704           of ns instantiation";
705
706       leaf name {
707         description "Name of this key pair";
708         type string;
709       }
710
711       leaf key {
712         description "Key associated with this key pair";
713         type string;
714       }
715     }
716
717     list user {
718       key "name";
719       description "List of users to be added through cloud-config";
720
721       leaf name {
722         description "Name of the user ";
723         type string;
724       }
725
726       leaf user-info {
727         description "The user name's real name";
728         type string;
729       }
730
731       list key-pair {
732         key "name";
733         description "Used to configure the list of public keys to be injected as part
734             of ns instantiation";
735
736         leaf name {
737           description "Name of this key pair";
738           type string;
739         }
740
741         leaf key {
742           description "Key associated with this key pair";
743           type string;
744         }
745       }
746     }
747   }
748
749   grouping nsd-vld-common {
750     /* Still having issues modelling this,
751        see the comments under vnfd-connection-point-ref
752     */
753     description
754       "List of Virtual Link Descriptors.";
755
756     leaf id {
757       description
758         "Identifier for the VLD.";
759       type string;
760     }
761
762     leaf name {
763       description
764         "Virtual Link Descriptor (VLD) name.";
765       type string;
766     }
767
768     leaf short-name {
769       description
770         "Short name to appear as label in the UI";
771       type string;
772     }
773
774     leaf vendor {
775       description "Provider of the VLD.";
776       type string;
777     }
778
779     leaf description {
780       description "Description of the VLD.";
781       type string;
782     }
783
784     leaf version {
785       description "Version of the VLD";
786       type string;
787     }
788
789     leaf type {
790       type manotypes:virtual-link-type;
791     }
792
793     leaf root-bandwidth {
794       description
795         "For ELAN this is the aggregate bandwidth.";
796       type uint64;
797     }
798
799     leaf leaf-bandwidth {
800       description
801         "For ELAN this is the bandwidth of branches.";
802       type uint64;
803     }
804
805     // replicate for pnfd container here
806     uses manotypes:provider-network;
807
808     leaf mgmt-network {
809       description "Flag indicating whether this network is a VIM management network";
810       type boolean;
811       default false;
812     }
813
814     choice init-params {
815       description "Extra parameters for VLD instantiation";
816
817       case vim-network-ref {
818         leaf vim-network-name {
819           description
820             "Name of network in VIM account. This is used to indicate
821                    pre-provisioned network name in cloud account.";
822           type string;
823         }
824       }
825
826       case vim-network-profile {
827         leaf ip-profile-ref {
828           description "Named reference to IP-profile object";
829           type leafref {
830             path "../../ip-profiles/name";
831           }
832         }
833       }
834
835     }
836   }
837
838   grouping monitoring-param-common {
839     description
840       "List of monitoring parameters from VNF's that should be
841         propogated up into NSR";
842
843     leaf id {
844       type string;
845     }
846
847     leaf name {
848       type string;
849     }
850
851     uses manotypes:monitoring-param-value;
852     uses manotypes:monitoring-param-ui-data;
853     uses manotypes:monitoring-param-aggregation;
854   }
855 }