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