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