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