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