Refactor manotypes:vnf-configuration
[osm/IM.git] / models / yang / nsd.yang
1
2 /*
3  *
4  *   Copyright 2016 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
22 {
23   namespace "urn:ietf:params:xml:ns:yang:nfvo:nsd";
24   prefix "nsd";
25
26   import rw-pb-ext {
27     prefix "rwpb";
28   }
29
30   import vnfd {
31     prefix "vnfd";
32   }
33
34   import ietf-inet-types {
35     prefix "inet";
36   }
37
38   import mano-types {
39     prefix "manotypes";
40   }
41
42   revision 2014-10-27 {
43     description
44       "Initial revision. This YANG file defines
45        the Network Service Descriptor (NSD)";
46     reference
47       "Derived from earlier versions of base YANG files";
48   }
49
50   typedef scaling-trigger {
51     type enumeration {
52       enum pre-scale-in {
53         value 1;
54       }
55       enum post-scale-in {
56         value 2;
57       }
58       enum pre-scale-out {
59         value 3;
60       }
61       enum post-scale-out {
62         value 4;
63       }
64     }
65   }
66
67   typedef scaling-policy-type {
68     type enumeration {
69       enum manual {
70         value 1;
71       }
72       enum automatic {
73         value 2;
74       }
75     }
76   }
77
78   typedef scaling-criteria-operation {
79     type enumeration {
80       enum AND {
81         value 1;
82       }
83       enum OR {
84         value 2;
85       }
86     }
87   }
88
89   grouping primitive-parameter {
90     leaf name {
91       description
92           "Name of the parameter.";
93       type string;
94     }
95
96     leaf data-type {
97       description
98           "Data type associated with the name.";
99       type manotypes:parameter-data-type;
100     }
101
102     leaf mandatory {
103       description "Is this field mandatory";
104       type boolean;
105       default false;
106     }
107
108     leaf default-value {
109       description "The default value for this field";
110       type string;
111     }
112
113     leaf parameter-pool {
114       description "NSD parameter pool name to use for this parameter";
115       type string;
116     }
117   }
118
119   grouping nsd-descriptor {
120     leaf id {
121       description "Identifier for the NSD.";
122       type string;
123     }
124
125     leaf name {
126       description "NSD name.";
127       mandatory true;
128       type string;
129     }
130
131     leaf short-name {
132       description "Short name to appear as label in the UI";
133       type string;
134     }
135
136     leaf vendor {
137       description "Vendor of the NSD.";
138       type string;
139     }
140
141     leaf logo {
142       description
143         "File path for the vendor-specific logo. For example, icons/mylogo.png.
144          The logo should be part of the network service";
145       type string;
146     }
147
148     leaf description {
149       description "Description of the NSD.";
150       type string;
151     }
152
153     leaf version {
154       description "Version of the NSD";
155       type string;
156     }
157
158     list connection-point {
159       description
160           "List for external connection points.
161           Each network service (NS) has one or more external connection
162           points that connect the NS to other NSs or to external networks.
163           Each NS exposes connection points to the orchestrator, which can
164           construct network service chains by connecting the connection
165           points between different NSs.";
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
180     /* Model Limitations,
181        see the comments under vnfd-connection-point-ref
182      */
183     list vld {
184       description
185           "List of Virtual Link Descriptors (VLDs).";
186
187       key "id";
188
189       leaf id {
190         description
191             "Identifier for the VLD.";
192         type string;
193       }
194
195       leaf name {
196         description
197             "Virtual Link Descriptor (VLD) name.";
198         type string;
199       }
200
201       leaf short-name {
202         description
203             "Short name to appear as label in the UI";
204         type string;
205       }
206
207       leaf vendor {
208         description "Provider of the VLD.";
209         type string;
210       }
211
212       leaf description {
213         description "Description of the VLD.";
214         type string;
215       }
216
217       leaf version {
218         description "Version of the VLD";
219         type string;
220       }
221
222       leaf type {
223         type manotypes:virtual-link-type;
224       }
225
226       leaf root-bandwidth {
227         description
228             "For ELAN this is the aggregate bandwidth.";
229         type uint64;
230       }
231
232       leaf leaf-bandwidth {
233         description
234             "For ELAN this is the bandwidth of branches.";
235         type uint64;
236       }
237
238       list vnfd-connection-point-ref {
239         description
240             "A list of references to connection points.";
241         key "member-vnf-index-ref vnfd-connection-point-ref";
242
243         leaf member-vnf-index-ref {
244           description "Reference to member-vnf within constituent-vnfds";
245           type leafref {
246             path "../../../constituent-vnfd/member-vnf-index";
247           }
248         }
249
250         leaf vnfd-id-ref {
251           description
252               "A reference to a VNFD";
253           type leafref {
254             path "../../../constituent-vnfd" +
255                  "[member-vnf-index = current()/../member-vnf-index-ref]" +
256                  "/vnfd-id-ref";
257           }
258         }
259
260         leaf vnfd-connection-point-ref {
261           description "A reference to a connection point name";
262           type leafref {
263             path "/vnfd:vnfd-catalog/vnfd:vnfd" +
264                  "[vnfd:id = current()/../vnfd-id-ref]/" +
265                  "vnfd:connection-point/vnfd:name";
266           }
267         }
268       }
269
270       // replicate for pnfd container here
271       uses manotypes:provider-network;
272
273       leaf mgmt-network {
274          description "Flag indicating whether this network is a VIM management network";
275          type boolean;
276          default false;
277       }
278
279       choice init-params {
280         description "Extra parameters for VLD instantiation";
281
282         case vim-network-ref {
283           leaf vim-network-name {
284             description
285                 "Name of network in VIM account. This is used to indicate
286                    pre-provisioned network name in cloud account.";
287             type string;
288           }
289         }
290
291         case vim-network-profile {
292           leaf ip-profile-ref {
293             description "Named reference to IP-profile object";
294             type leafref {
295               path "../../ip-profiles/name";
296             }
297           }
298         }
299       }
300     }
301
302     list constituent-vnfd {
303       description
304           "List of VNFDs that are part of this
305           network service.";
306
307       key "member-vnf-index";
308
309       leaf member-vnf-index {
310         description
311           "Identifier/index for the VNFD. This separate id
312            is required so that multiple VNFs can be part of
313            single NS";
314         type uint64;
315       }
316
317       leaf vnfd-id-ref {
318         description
319           "Identifier for the VNFD.";
320         type leafref {
321           path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
322         }
323       }
324
325       leaf start-by-default {
326         description
327           "VNFD is started as part of the NS instantiation";
328         type boolean;
329         default true;
330       }
331     }
332
333     list scaling-group-descriptor {
334       description
335           "Scaling group descriptor within this network service.
336            The scaling group defines a group of VNFs,
337            and the ratio of VNFs in the network service
338            that is used as target for scaling action";
339
340       key "name";
341
342       leaf name {
343         description "Name of this scaling group.";
344         type string;
345       }
346
347       list scaling-policy {
348
349         key "name";
350
351         leaf name {
352           description
353               "Name of the scaling policy";
354           type string;
355         }
356
357         leaf scaling-type {
358           description
359               "Type of scaling";
360           type scaling-policy-type;
361         }
362
363         leaf enabled {
364           description
365             "Specifies if the scaling policy can be applied";
366           type boolean;
367           default true;
368         }
369
370         leaf scale-in-operation-type {
371           description
372               "Operation to be applied to check between scaling criterias to
373                check if the scale in threshold condition has been met.
374                Defaults to AND";
375           type scaling-criteria-operation;
376           default AND;
377         }
378
379         leaf scale-out-operation-type {
380           description
381               "Operation to be applied to check between scaling criterias to
382                check if the scale out threshold condition has been met.
383                Defaults to OR";
384           type scaling-criteria-operation;
385           default OR;
386         }
387
388         leaf threshold-time {
389           description
390             "The duration for which the criteria must hold true";
391           type uint32;
392           mandatory true;
393         }
394
395         leaf cooldown-time {
396           description
397             "The duration after a scaling-in/scaling-out action has been
398             triggered, for which there will be no further scaling activity";
399           type uint32;
400           mandatory true;
401         }
402
403         list scaling-criteria {
404           description
405               "list of conditions to be met for generating scaling
406                  requests";
407           key "name";
408
409           leaf name {
410             description "Name of the scaling criteria";
411             type string;
412           }
413
414           leaf scale-in-threshold {
415             description
416                 "Value below which scale-in requests are generated
417                  (depends on monitoring parameters)";
418             type uint64;
419           }
420
421           leaf scale-out-threshold {
422             description
423                 "Value above which scale-out requests are generated
424                  (depends on monitoring parameters)";
425             type uint64;
426           }
427
428           leaf ns-monitoring-param-ref {
429             description
430                "Reference to the NS level monitoring parameter
431                 that is aggregated";
432             type leafref {
433               path "../../../../monitoring-param/id";
434             }
435           }
436         }
437       }
438
439       list vnfd-member {
440         description "List of VNFs in this scaling group";
441         key "member-vnf-index-ref";
442
443         leaf member-vnf-index-ref {
444           description "Member VNF index of this member VNF";
445           type leafref {
446             path "../../../constituent-vnfd/member-vnf-index";
447           }
448         }
449
450         leaf count {
451           description
452             "Count of this member VNF  within this scaling group.
453              The count defines the number of instances when a
454              scaling action targets this scaling group.";
455           type uint32;
456           default 1;
457         }
458       }
459
460       leaf min-instance-count {
461         description
462           "Minimum number of instances of the scaling group that
463           are allowed in a single network service. These instances
464           are created by default when the network service is
465           instantiated.";
466         type uint32;
467         default 0;
468       }
469
470       leaf max-instance-count {
471         description
472           "Maximum number of instances of this scaling group that
473           are allowed in a single network service. The network
474           service scaling fails when the number of service group
475           instances exceeds the max-instance-count specified.";
476         type uint32;
477         default 10;
478       }
479
480       list scaling-config-action {
481         description "List of scaling config actions";
482         key "trigger";
483
484         leaf trigger {
485           description "Scaling trigger";
486           type scaling-trigger;
487         }
488
489         leaf ns-config-primitive-name-ref {
490           description "Reference to the NS config name primitive";
491           type leafref {
492             path "../../../service-primitive/name";
493           }
494         }
495       }
496     }
497
498     list placement-groups {
499       description "List of placement groups at NS level";
500
501       key "name";
502       uses manotypes:placement-group-info;
503
504       list member-vnfd {
505         description
506             "List of VNFDs that are part of this placement group";
507
508         key "member-vnf-index-ref";
509
510         leaf member-vnf-index-ref {
511           description "Member VNF index of this member VNF";
512           type leafref {
513             path "../../../constituent-vnfd/member-vnf-index";
514           }
515         }
516
517         leaf vnfd-id-ref {
518           description
519               "Identifier for the VNFD.";
520           type leafref {
521             path "../../../constituent-vnfd" +
522                  "[member-vnf-index = current()/../member-vnf-index-ref]" +
523                  "/vnfd-id-ref";
524           }
525         }
526       }
527     }
528
529     uses manotypes:ip-profile-list;
530
531     list vnf-dependency {
532       description
533           "List of VNF dependencies.";
534       key vnf-source-ref;
535       leaf vnf-source-ref {
536         type leafref {
537           path "../../constituent-vnfd/vnfd-id-ref";
538         }
539       }
540       leaf vnf-depends-on-ref {
541         description
542             "Reference to VNF on which the source VNF depends.";
543         type leafref {
544           path "../../constituent-vnfd/vnfd-id-ref";
545         }
546       }
547     }
548
549     list vnffgd {
550       description
551           "List of VNF Forwarding Graph Descriptors (VNFFGD).";
552
553       key "id";
554
555       leaf id {
556         description
557             "Identifier for the VNFFGD.";
558         type string;
559       }
560
561       leaf name {
562         description
563             "VNFFGD name.";
564         type string;
565       }
566
567       leaf short-name {
568         description
569             "Short name to appear as label in the UI";
570         type string;
571       }
572
573       leaf vendor {
574         description "Provider of the VNFFGD.";
575         type string;
576       }
577
578       leaf description {
579         description "Description of the VNFFGD.";
580         type string;
581       }
582
583       leaf version {
584         description "Version of the VNFFGD";
585         type string;
586       }
587
588       list rsp {
589         description
590             "List of Rendered Service Paths (RSP).";
591
592         key "id";
593
594         leaf id {
595           description
596               "Identifier for the RSP.";
597           type string;
598         }
599
600         leaf name {
601           description
602               "RSP name.";
603           type string;
604         }
605
606         list vnfd-connection-point-ref {
607           description
608                 "A list of references to connection points.";
609           key "member-vnf-index-ref";
610
611           leaf member-vnf-index-ref {
612             description "Reference to member-vnf within constituent-vnfds";
613             type leafref {
614               path "../../../../constituent-vnfd/member-vnf-index";
615             }
616           }
617
618           leaf order {
619             type uint8;
620             description
621                 "A number that denotes the order of a VNF in a chain";
622           }
623
624            leaf vnfd-id-ref {
625              description
626                  "A reference to a vnfd";
627              type leafref {
628                 path "../../../../constituent-vnfd" +
629                      "[member-vnf-index = current()/../member-vnf-index-ref]" +
630                      "/vnfd-id-ref";
631              }
632            }
633
634            leaf vnfd-connection-point-ref {
635              description
636                  "A reference to a connection point name";
637              type leafref {
638                path "/vnfd:vnfd-catalog/vnfd:vnfd" +
639                     "[vnfd:id = current()/../vnfd-id-ref]/" +
640                     "vnfd:connection-point/vnfd:name";
641              }
642           }
643         }
644       } //rsp
645
646       list classifier {
647         description
648             "List of classifier rules.";
649
650         key "id";
651
652         leaf id {
653           description
654               "Identifier for the classifier rule.";
655           type string;
656         }
657
658         leaf name {
659           description
660               "Name of the classifier.";
661           type string;
662         }
663
664         leaf rsp-id-ref {
665           description
666               "A reference to the RSP.";
667           type leafref {
668             path "../../rsp/id";
669           }
670         }
671
672         leaf member-vnf-index-ref {
673           description "Reference to member-vnf within constituent-vnfds";
674           type leafref {
675             path "../../../constituent-vnfd/member-vnf-index";
676           }
677         }
678
679         leaf vnfd-id-ref {
680           description
681               "A reference to a VNFD";
682           type leafref {
683               path "../../../constituent-vnfd" +
684                    "[member-vnf-index = current()/../member-vnf-index-ref]" +
685                    "/vnfd-id-ref";
686           }
687         }
688
689         leaf vnfd-connection-point-ref {
690           description
691               "A reference to a connection point name";
692           type leafref {
693               path "/vnfd:vnfd-catalog/vnfd:vnfd" +
694                    "[vnfd:id = current()/../vnfd-id-ref]/" +
695                    "vnfd:connection-point/vnfd:name";
696           }
697         }
698
699         list match-attributes {
700           description
701               "List of match attributes.";
702
703           key "id";
704
705           leaf id {
706             description
707                 "Identifier for the classifier match attribute rule.";
708             type string;
709           }
710
711           leaf ip-proto {
712             description
713                 "Internet Protocol.";
714             type uint8;
715           }
716
717           leaf source-ip-address {
718             description
719                 "Source IP address.";
720             type inet:ip-address;
721           }
722
723           leaf destination-ip-address {
724             description
725                 "Destination IP address.";
726             type inet:ip-address;
727           }
728
729           leaf source-port {
730             description
731                 "Source port number.";
732             type inet:port-number;
733           }
734
735           leaf destination-port {
736             description
737                 "Destination port number.";
738             type inet:port-number;
739           }
740         } //match-attributes
741       } // classifier
742     } // vnffgd
743
744     list monitoring-param {
745       description
746         "List of monitoring parameters from VNFs that should be
747         propogated up into NSR";
748       key "id";
749
750       leaf id {
751         description "Identifier for a monitoring parameter";
752         type string;
753       }
754
755       leaf name {
756         description "Name of the monitoring parameter";
757         type string;
758       }
759
760       uses manotypes:monitoring-param-value;
761       uses manotypes:monitoring-param-ui-data;
762       uses manotypes:monitoring-param-aggregation;
763
764       list vnfd-monitoring-param {
765         description "A list of VNFD monitoring params";
766         key "member-vnf-index-ref vnfd-monitoring-param-ref";
767
768         leaf vnfd-id-ref {
769           description
770              "A reference to a VNFD. This is a leafref";
771
772           type leafref {
773             path "../../../constituent-vnfd" +
774                  "[member-vnf-index = current()/../member-vnf-index-ref]" +
775                  "/vnfd-id-ref";
776           }
777         }
778
779         leaf vnfd-monitoring-param-ref {
780           description "A reference to the VNFD monitoring param";
781           type leafref {
782             path "/vnfd:vnfd-catalog/vnfd:vnfd"
783               + "[vnfd:id = current()/../vnfd-id-ref]"
784               + "/vnfd:monitoring-param/vnfd:id";
785           }
786         }
787
788         leaf member-vnf-index-ref {
789           description
790             "Mandatory reference to member-vnf within constituent-vnfds";
791           type leafref {
792             path "../../../constituent-vnfd/member-vnf-index";
793           }
794         }
795       }
796     }
797
798     uses manotypes:input-parameter-xpath;
799
800     list parameter-pool {
801       description
802          "Pool of parameter values from which to choose during
803          configuration.";
804       key "name";
805
806       leaf name {
807         description
808             "Name of the configuration value pool";
809         type string;
810       }
811
812       container range {
813         description
814             "Create a range of values from which to populate the pool with";
815
816         leaf start-value {
817           description
818               "Generated pool values start at this value";
819           type uint32;
820           mandatory true;
821         }
822
823         leaf end-value {
824           description
825               "Generated pool values stop at this value";
826           type uint32;
827           mandatory true;
828         }
829       }
830     }
831
832     list service-primitive {
833       description
834           "Network service level service primitives.";
835
836       key "name";
837
838       leaf name {
839         description
840             "Name of the service primitive.";
841         type string;
842       }
843
844       list parameter {
845         description
846             "List of parameters for the service primitive.";
847
848         key "name";
849         uses manotypes:primitive-parameter;
850       }
851
852       uses manotypes:ui-primitive-group;
853
854       list vnf-primitive-group {
855         description
856             "List of service primitives grouped by VNF.";
857
858         key "member-vnf-index-ref";
859         leaf member-vnf-index-ref {
860           description
861               "Reference to member-vnf within constituent-vnfds";
862           type leafref {
863              path "../../../constituent-vnfd/member-vnf-index";
864           }
865         }
866
867         leaf vnfd-id-ref {
868           description
869               "A reference to a VNFD. This is a leafref";
870
871           type leafref {
872              path "../../../constituent-vnfd" +
873                 "[member-vnf-index = current()/../member-vnf-index-ref]" + "/vnfd-id-ref";
874           }
875         }
876
877         leaf vnfd-name {
878           description
879               "Name of the VNFD";
880           type leafref {
881               path "/vnfd:vnfd-catalog/vnfd:vnfd"
882                     + "[vnfd:id = current()/../vnfd-id-ref]"
883                     + "/vnfd:name";
884           }
885         }
886
887         list primitive {
888           key "index";
889
890           leaf index {
891             description "Index of this primitive";
892             type uint32;
893           }
894
895           leaf name {
896             description "Name of the primitive in the VNF primitive ";
897             type string;
898           }
899         }
900       }
901
902       leaf user-defined-script {
903         description
904             "A user defined script.";
905         type string;
906       }
907     }
908
909     list initial-config-primitive {
910       rwpb:msg-new NsdInitialConfigPrimitive;
911       description
912         "Initial set of configuration primitives for NSD.";
913       key "seq";
914
915       uses manotypes:initial-config;
916     }
917
918     list key-pair {
919       key "name";
920       description "Used to configure the list of public keys to be injected as part
921           of NS instantiation";
922
923       leaf name {
924         description "Name of this key pair";
925         type string;
926       }
927
928       leaf key {
929         description "Key associated with this key pair";
930         type string;
931       }
932     }
933
934     list user {
935       key "name";
936       description "List of users to be added through cloud-config";
937
938       leaf name {
939         description "Name of the user ";
940         type string;
941       }
942
943       leaf user-info {
944         description "The user name's real name";
945         type string;
946       }
947
948       list key-pair {
949         key "name";
950         description "Used to configure the list of public keys to be injected as part
951             of NS instantiation";
952
953         leaf name {
954           description "Name of this key pair";
955           type string;
956         }
957
958         leaf key {
959           description "Key associated with this key pair";
960           type string;
961         }
962       }
963     }
964   }
965
966
967   container nsd-catalog {
968
969     list nsd {
970       key "id";
971
972       uses nsd-descriptor;
973     }
974   }
975
976 }