New Feature : Support VNF service access points, model changes
[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
312                "A reference to a connection point name
313                 in a vnfd. This is a leafref to path:
314                     /vnfd:vnfd-catalog/vnfd:vnfd
315                     + [vnfd:id = current()/../nsd:vnfd-id-ref]
316                     + /vnfd:connection-point/vnfd:name
317                 NOTE: An issue with confd is preventing the
318                 use of xpath. Seems to be an issue with leafref
319                 to leafref, whose target is in a different module.
320                 Once that is resovled this will switched to use
321                 leafref";
322             type string;
323         }
324       }
325
326       list vnfap-map {
327         key "id";
328         description "A mapping of VNF application point 
329                      capability/dependency within this network service";
330         leaf id {
331           description "Identfier for VNF access point map";
332           type string;
333         }
334         container capability {
335           leaf member-vnf-index-ref {
336             description "Reference to member-vnf within constituent-vnfds";
337             type leafref {
338               path "../../../../constituent-vnfd/member-vnf-index";
339             }
340           }
341           leaf capability-ref {
342             description "Reference to the capability with the capability of the VNF
343                          with the specified member-vnf-index";
344             type leafref {
345               path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:vnfap/vnfd:capability/vnfd:name";
346             }
347           }
348         }
349         container dependency {
350           leaf member-vnf-index-ref {
351             description "Reference to member-vnf within constituent-vnfds";
352             type leafref {
353               path "../../../../constituent-vnfd/member-vnf-index";
354             }
355           }
356           leaf dependency-ref {
357             description "Reference to the dependency within the dependency of the VNF
358                          with the specified member-vnf-index";
359             type leafref {
360               path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:vnfap/vnfd:dependency/vnfd:name";
361             }
362           }
363         }
364       }
365
366       // replicate for pnfd container here
367       uses manotypes:provider-network;
368
369       choice init-params {
370         description "Extra parameters for VLD instantiation";
371
372         case vim-network-ref {
373           leaf vim-network-name {
374             description
375                 "Name of network in VIM account. This is used to indicate
376                    pre-provisioned network name in cloud account.";
377             type string;
378           }
379         }
380         case vim-network-profile {
381           leaf ip-profile-ref {
382             description "Named reference to IP-profile object";
383             type string;
384           } 
385         }   
386       }
387     }
388
389     list constituent-vnfd {
390       description
391           "List of VNFDs that are part of this
392           network service.";
393
394       key "member-vnf-index";
395
396       leaf member-vnf-index {
397         description
398           "Identifier/index for the VNFD. This separate id
399            is required to ensure that multiple VNFs can be
400            part of single NS";
401         type uint64;
402       }
403
404       leaf vnfd-id-ref {
405         description
406           "Identifier for the VNFD.";
407         type leafref {
408           path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
409         }
410       }
411
412       leaf start-by-default {
413         description
414           "VNFD is started as part of the NS instantiation";
415         type boolean;
416         default true;
417       }
418     }
419
420     list vnfap-map {
421       description
422         "Mapping of capability and dependency in this
423          network service.";
424       key "id";
425
426       leaf id {
427         description "Identifier for VNF access point mapping";
428         type string;
429       }
430
431       container capability {
432         leaf member-vnf-index {
433           description "Reference to member VNF within this network service";
434           type leafref {
435             path "../../../constituent-vnfd/member-vnf-index";
436           }
437         }
438
439         leaf capability-ref {
440           description
441             "Reference to the capability in the specified
442              member VNF. This should be a leafref as follows:
443              path \"/vnfd:vnf-catalog/vnfd[id=
444                     ../../constituent-vnfd[member-vnf-index=
445                     ../member-vnf-index]/vnfd-id-ref]/
446                     vnfap/capability/name\"";
447             type string;
448         }
449       }
450
451       container dependency {
452         leaf member-vnf-index {
453           description "Reference to member VNF within this network service";
454           type leafref {
455             path "../../../constituent-vnfd/member-vnf-index";
456           }
457         }
458
459         leaf dependency-ref {
460           description
461             "Reference to the depenency in the specified
462              member VNF. This should be a leafref as follows:
463              path \"/vnfd:vnf-catalog/vnfd[id=
464                     ../../constituent-vnfd[member-vnf-index=
465                     ../member-vnf-index]/vnfd-id-ref]/
466                     vnfap/dependency/name\"";
467             type string;
468         }
469       }
470     }
471
472     list scaling-group-descriptor {
473       description
474           "scaling group descriptor within this network service.
475            The scaling group defines a group of VNFs,
476            and the ratio of VNFs in the network service
477            that is used as target for scaling action";
478
479       key "name";
480
481       leaf name {
482         description "Name of this scaling group.";
483         type string;
484       }
485
486       list scaling-policy {
487
488         key "name";
489
490         leaf name {
491           description
492               "Name of the scaling policy";
493           type string;
494         }
495
496         leaf scaling-type {
497           description
498               "Type of scaling";
499           type scaling-policy-type;
500         }
501
502         leaf enabled {
503           description
504             "Specifies if the scaling policy can be applied";
505           type boolean;
506           default true;
507         }
508
509         leaf scale-in-operation-type {
510           description
511               "Operation to be applied to check between scaling criterias to 
512                check if the scale in threshold condition has been met.
513                Defaults to AND";
514           type scaling-criteria-operation;
515           default AND;
516         }
517
518         leaf scale-out-operation-type {
519           description
520               "Operation to be applied to check between scaling criterias to 
521                check if the scale out threshold condition has been met.
522                Defauls to OR";
523           type scaling-criteria-operation;
524           default OR;
525         }
526
527         leaf threshold-time {
528           description
529             "The duration for which the criteria must hold true";
530           type uint32;
531           mandatory true;
532         }
533
534         leaf cooldown-time {
535           description
536             "The duration after a scaling-in/scaling-out action has been
537             triggered, for which there will be no further optional";
538           type uint32;
539           mandatory true;
540         }
541
542         list scaling-criteria {
543           description
544               "list of conditions to be met for generating scaling
545                  requests";
546           key "name";
547
548           leaf name {
549             type string;
550           }
551
552           leaf scale-in-threshold {
553             description
554                 "Value below which scale-in requests are generated";
555             type uint64;
556           }
557
558           leaf scale-out-threshold {
559             description
560                 "Value above which scale-out requests are generated";
561             type uint64;
562           }
563
564           leaf ns-monitoring-param-ref {
565             description 
566                "Reference to the NS level monitoring parameter
567                 that is aggregated";
568             type leafref {
569               path "../../../../monitoring-param/id";
570             }
571           }
572         }
573       }
574
575       list vnfd-member {
576         description "List of VNFs in this scaling group";
577         key "member-vnf-index-ref";
578
579         leaf member-vnf-index-ref {
580           description "member VNF index of this member VNF";
581           type leafref {
582             path "../../../constituent-vnfd/member-vnf-index";
583           }
584         }
585
586         leaf count {
587           description
588             "count of this member VNF  within this scaling group.
589              The count allows to define  the number of instances
590              when a scaling action targets this scaling group";
591           type uint32;
592           default 1;
593         }
594       }
595
596       leaf min-instance-count {
597         description
598           "Minimum instances of the scaling group which are allowed.
599           These instances are created by default when the network service
600           is instantiated.";
601         type uint32;
602         default 0;
603       }
604
605       leaf max-instance-count {
606         description
607           "Maximum instances of this scaling group that are allowed
608            in a single network service. The network service scaling
609            will fail, when the number of service group instances
610            exceed the max-instance-count specified.";
611         type uint32;
612         default 10;
613       }
614
615       list scaling-config-action {
616         description "List of scaling config actions";
617         key "trigger";
618
619         leaf trigger {
620           description "scaling trigger";
621           type scaling-trigger;
622         }
623
624         leaf ns-config-primitive-name-ref {
625           description "Reference to the NS config name primitive";
626           type leafref {
627             path "../../../service-primitive/name";
628           }
629         }
630       }
631     }
632
633     list placement-groups {
634       description "List of placement groups at NS level";
635
636       key "name";
637       uses manotypes:placement-group-info;
638
639       list member-vnfd {
640         description
641             "List of VNFDs that are part of this placement group";
642
643         key "member-vnf-index-ref";
644
645         leaf member-vnf-index-ref {
646           description "member VNF index of this member VNF";
647           type leafref {
648             path "../../../constituent-vnfd/member-vnf-index";
649           }
650         }
651
652         leaf vnfd-id-ref {
653           description
654               "Identifier for the VNFD.";
655           type leafref {
656             path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
657           }
658         }
659       }
660     }
661
662     uses manotypes:ip-profile-list;
663
664     list vnf-dependency {
665       description
666           "List of VNF dependencies.";
667       key vnf-source-ref;
668       leaf vnf-source-ref {
669         type leafref {
670           path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
671         }
672       }
673       leaf vnf-depends-on-ref {
674         description
675             "Reference to VNF that sorce VNF depends.";
676         type leafref {
677           path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
678         }
679       }
680     }
681
682     list vnffgd {
683       description
684           "List of VNF Forwarding Graph Descriptors (VNFFGD).";
685
686       key "id";
687
688       leaf id {
689         description
690             "Identifier for the VNFFGD.";
691         type string;
692       }
693
694       leaf name {
695         description
696             "VNFFGD name.";
697         type string;
698       }
699
700       leaf short-name {
701         description
702             "Short name for VNFFGD for UI";
703         type string;
704       }
705
706       leaf vendor {
707         description "Provider of the VNFFGD.";
708         type string;
709       }
710
711       leaf description {
712         description "Description of the VNFFGD.";
713         type string;
714       }
715
716       leaf version {
717         description "Version of the VNFFGD";
718         type string;
719       }
720
721       list rsp {
722         description
723             "List of Rendered Service Paths (RSP).";
724
725         key "id";
726
727         leaf id {
728           description
729               "Identifier for the RSP.";
730           type string;
731         }
732
733         leaf name {
734           description
735               "RSP name.";
736           type string;
737         }
738
739         list vnfd-connection-point-ref {
740           description
741                 "A list of references to connection points.";
742           key "member-vnf-index-ref";
743
744           leaf member-vnf-index-ref {
745             description "Reference to member-vnf within constituent-vnfds";
746             type leafref {
747               path "../../../../constituent-vnfd/member-vnf-index";
748             }
749           }
750
751           leaf order {
752             type uint8;
753             description
754                 "A number that denotes the order of a VNF in a chain";
755           }
756
757            leaf vnfd-id-ref {
758              description
759                  "A reference to a vnfd. This is a
760                   leafref to path:
761                       ../../../../nsd:constituent-vnfd
762                       + [nsd:id = current()/../nsd:id-ref]
763                       + /nsd:vnfd-id-ref
764                   NOTE: An issue with confd is preventing the
765                   use of xpath. Seems to be an issue with leafref
766                   to leafref, whose target is in a different module.
767                   Once that is resovled this will switched to use
768                   leafref";
769              type string;
770            }
771
772            leaf vnfd-connection-point-ref {
773              description
774                  "A reference to a connection point name
775                   in a vnfd. This is a leafref to path:
776                       /vnfd:vnfd-catalog/vnfd:vnfd
777                       + [vnfd:id = current()/../nsd:vnfd-id-ref]
778                       + /vnfd:connection-point/vnfd:name
779                   NOTE: An issue with confd is preventing the
780                   use of xpath. Seems to be an issue with leafref
781                   to leafref, whose target is in a different module.
782                   Once that is resovled this will switched to use
783                   leafref";
784               type string;
785           }
786         }
787       } //rsp
788
789       list classifier {
790         description
791             "List of classifier rules.";
792
793         key "id";
794
795         leaf id {
796           description
797               "Identifier for the classifier rule.";
798           type string;
799         }
800
801         leaf name {
802           description
803               "Name of the classifier.";
804           type string;
805         }
806
807         leaf rsp-id-ref {
808           description
809               "A reference to the RSP.";
810           type leafref {
811             path "../../rsp/id";
812           }
813         }
814
815         leaf member-vnf-index-ref {
816           description "Reference to member-vnf within constituent-vnfds";
817           type leafref {
818             path "../../../constituent-vnfd/member-vnf-index";
819           }
820         }
821
822         leaf vnfd-id-ref {
823           description
824               "A reference to a vnfd. This is a
825                   leafref to path:
826                       ../../../nsd:constituent-vnfd
827                       + [nsd:id = current()/../nsd:id-ref]
828                       + /nsd:vnfd-id-ref
829                   NOTE: An issue with confd is preventing the
830                   use of xpath. Seems to be an issue with leafref
831                   to leafref, whose target is in a different module.
832                   Once that is resovled this will switched to use
833                   leafref";
834           type string;
835         }
836
837         leaf vnfd-connection-point-ref {
838           description
839               "A reference to a connection point name
840                   in a vnfd. This is a leafref to path:
841                       /vnfd:vnfd-catalog/vnfd:vnfd
842                       + [vnfd:id = current()/../nsd:vnfd-id-ref]
843                       + /vnfd:connection-point/vnfd:name
844                   NOTE: An issue with confd is preventing the
845                   use of xpath. Seems to be an issue with leafref
846                   to leafref, whose target is in a different module.
847                   Once that is resovled this will switched to use
848                   leafref";
849           type string;
850         }
851
852         list match-attributes {
853           description
854               "List of match attributes.";
855
856           key "id";
857
858           leaf id {
859             description
860                 "Identifier for the classifier match attribute rule.";
861             type string;
862           }
863
864           leaf ip-proto {
865             description
866                 "IP Protocol.";
867             type uint8;
868           }
869
870           leaf source-ip-address {
871             description
872                 "Source IP address.";
873             type inet:ip-address;
874           }
875
876           leaf destination-ip-address {
877             description
878                 "Destination IP address.";
879             type inet:ip-address;
880           }
881
882           leaf source-port {
883             description
884                 "Source port number.";
885             type inet:port-number;
886           }
887
888           leaf destination-port {
889             description
890                 "Destination port number.";
891             type inet:port-number;
892           }
893           //TODO: Add more match criteria
894         } //match-attributes
895       } // classifier
896     } // vnffgd
897
898     list monitoring-param {
899       description
900         "List of monitoring parameters from VNF's that should be
901         propogated up into NSR";
902       key "id";
903
904       leaf id {
905         type string;
906       }
907
908       leaf name {
909         type string;
910       }
911
912       uses manotypes:monitoring-param-value;
913       uses manotypes:monitoring-param-ui-data;
914       uses manotypes:monitoring-param-aggregation;
915
916       list vnfd-monitoring-param {
917         description "A list of VNFD monitoring params";
918         key "vnfd-id-ref vnfd-monitoring-param-ref";
919
920         leaf vnfd-id-ref {
921           description
922              "A reference to a vnfd. This is a
923               leafref to path:
924                   ../../../../nsd:constituent-vnfd
925                   + [nsd:id = current()/../nsd:id-ref]
926                   + /nsd:vnfd-id-ref
927               NOTE: An issue with confd is preventing the
928               use of xpath. Seems to be an issue with leafref
929               to leafref, whose target is in a different module.
930               Once that is resolved this will switched to use
931               leafref";
932
933           type yang:uuid;
934         }
935
936         leaf vnfd-monitoring-param-ref {
937           description "A reference to the VNFD monitoring param";
938           type leafref {
939             path "/vnfd:vnfd-catalog/vnfd:vnfd"
940               + "[vnfd:id = current()/../vnfd-id-ref]"
941               + "/vnfd:monitoring-param/vnfd:id";
942           }
943         }
944
945         leaf-list member-vnf-index-ref {
946          description
947             "Optional reference to member-vnf within constituent-vnfds";
948          type uint64;
949         }
950       }
951     }
952
953     uses manotypes:input-parameter-xpath;
954
955     list parameter-pool {
956       description
957         "Pool of parameter values which must be
958          pulled from during configuration";
959       key "name";
960
961       leaf name {
962         description
963             "Name of the configuration value pool";
964         type string;
965       }
966
967       container range {
968         description
969             "Create a range of values to populate the pool with";
970
971         leaf start-value {
972           description
973               "Generated pool values start at this value";
974           type uint32;
975           mandatory true;
976         }
977
978         leaf end-value {
979           description
980               "Generated pool values stop at this value";
981           type uint32;
982           mandatory true;
983         }
984       }
985     }
986
987     uses manotypes:ns-service-primitive;
988
989     list initial-config-primitive {
990       rwpb:msg-new NsdInitialConfigPrimitive;
991       description
992         "Initial set of configuration primitives for NSD.";
993       key "seq";
994
995       uses ns-initial-config-primitive;
996     }
997
998     list key-pair {
999       key "name";
1000       description "Used to configure the list of public keys to be injected as part
1001           of ns instantiation";
1002
1003       leaf name {
1004         description "Name of this key pair";
1005         type string;
1006       }
1007
1008       leaf key {
1009         description "Key associated with this key pair";
1010         type string;
1011       }
1012     }
1013
1014     list user {
1015       key "name";
1016       description "List of users to be added through cloud-config";
1017
1018       leaf name {
1019         description "Name of the user ";
1020         type string;
1021       }
1022
1023       leaf user-info {
1024         description "The user name's real name";
1025         type string;
1026       }
1027
1028       list key-pair {
1029         key "name";
1030         description "Used to configure the list of public keys to be injected as part
1031             of ns instantiation";
1032
1033         leaf name {
1034           description "Name of this key pair";
1035           type string;
1036         }
1037
1038         leaf key {
1039           description "Key associated with this key pair";
1040           type string;
1041         }
1042       }
1043     }
1044   }
1045
1046
1047   container nsd-catalog {
1048
1049     list nsd {
1050       key "id";
1051
1052       uses nsd-descriptor;
1053     }
1054   }
1055
1056 }