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