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