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