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