15cd2e376ed29d3bd392f98e4a0527e65f543848
[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 NS has one or more external connection
170           points. As the name implies that external
171           connection points are used for connecting
172           the NS to other NS or to external networks.
173           Each NS exposes these connection points to
174           the orchestrator. The orchestrator can
175           construct network service chains by
176           connecting the connection points between
177           different NS.";
178
179       key "name";
180       leaf name {
181         description
182             "Name of the NS connection point.";
183         type string;
184       }
185
186       leaf type {
187         description
188             "Type of the connection point.";
189         type manotypes:connection-point-type;
190       }
191     }
192
193     /* Still having issues modelling this,
194        see the comments under vnfd-connection-point-ref
195      */
196     list vld {
197       description
198           "List of Virtual Link Descriptors.";
199
200       key "id";
201
202       leaf id {
203         description
204             "Identifier for the VLD.";
205         type string;
206       }
207
208       leaf name {
209         description
210             "Virtual Link Descriptor (VLD) name.";
211         type string;
212       }
213
214       leaf short-name {
215         description
216             "Short name to appear as label in the UI";
217         type string;
218       }
219
220       leaf vendor {
221         description "Provider of the VLD.";
222         type string;
223       }
224
225       leaf description {
226         description "Description of the VLD.";
227         type string;
228       }
229
230       leaf version {
231         description "Version of the VLD";
232         type string;
233       }
234
235       leaf type {
236         type manotypes:virtual-link-type;
237       }
238
239       leaf root-bandwidth {
240         description
241             "For ELAN this is the aggregate bandwidth.";
242         type uint64;
243       }
244
245       leaf leaf-bandwidth {
246         description
247             "For ELAN this is the bandwidth of branches.";
248         type uint64;
249       }
250
251       list vnfd-connection-point-ref {
252         description
253             "A list of references to connection points.";
254         key "member-vnf-index-ref vnfd-connection-point-ref";
255
256         leaf member-vnf-index-ref {
257           description "Reference to member-vnf within constituent-vnfds";
258           type leafref {
259             path "../../../constituent-vnfd/member-vnf-index";
260           }
261         }
262
263         leaf vnfd-id-ref {
264           description
265               "A reference to a vnfd";
266           type leafref {
267             path "../../../constituent-vnfd" +
268                  "[member-vnf-index = current()/../member-vnf-index-ref]" +
269                  "/vnfd-id-ref";
270           }
271         }
272
273         leaf vnfd-connection-point-ref {
274           description "A reference to a connection point name";
275           type leafref {
276             path "/vnfd:vnfd-catalog/vnfd:vnfd" +
277                  "[vnfd:id = current()/../vnfd-id-ref]/" +
278                  "vnfd:connection-point/vnfd:name";
279           }
280         }
281       }
282
283       // replicate for pnfd container here
284       uses manotypes:provider-network;
285
286       leaf mgmt-network {
287          description "Flag indicating whether this network is a VIM management network"; 
288          type boolean;
289          default false;
290       }
291
292       choice init-params {
293         description "Extra parameters for VLD instantiation";
294
295         case vim-network-ref {
296           leaf vim-network-name {
297             description
298                 "Name of network in VIM account. This is used to indicate
299                    pre-provisioned network name in cloud account.";
300             type string;
301           }
302         }
303
304         case vim-network-profile {
305           leaf ip-profile-ref {
306             description "Named reference to IP-profile object";
307             type string;
308           } 
309         }
310
311       }
312     }
313
314     list constituent-vnfd {
315       description
316           "List of VNFDs that are part of this
317           network service.";
318
319       key "member-vnf-index";
320
321       leaf member-vnf-index {
322         description
323           "Identifier/index for the VNFD. This separate id
324            is required to ensure that multiple VNFs can be
325            part of single NS";
326         type uint64;
327       }
328
329       leaf vnfd-id-ref {
330         description
331           "Identifier for the VNFD.";
332         type leafref {
333           path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
334         }
335       }
336
337       leaf start-by-default {
338         description
339           "VNFD is started as part of the NS instantiation";
340         type boolean;
341         default true;
342       }
343     }
344
345     list scaling-group-descriptor {
346       description
347           "scaling group descriptor within this network service.
348            The scaling group defines a group of VNFs,
349            and the ratio of VNFs in the network service
350            that is used as target for scaling action";
351
352       key "name";
353
354       leaf name {
355         description "Name of this scaling group.";
356         type string;
357       }
358
359       list scaling-policy {
360
361         key "name";
362
363         leaf name {
364           description
365               "Name of the scaling policy";
366           type string;
367         }
368
369         leaf scaling-type {
370           description
371               "Type of scaling";
372           type scaling-policy-type;
373         }
374
375         leaf enabled {
376           description
377             "Specifies if the scaling policy can be applied";
378           type boolean;
379           default true;
380         }
381
382         leaf scale-in-operation-type {
383           description
384               "Operation to be applied to check between scaling criterias to 
385                check if the scale in threshold condition has been met.
386                Defaults to AND";
387           type scaling-criteria-operation;
388           default AND;
389         }
390
391         leaf scale-out-operation-type {
392           description
393               "Operation to be applied to check between scaling criterias to 
394                check if the scale out threshold condition has been met.
395                Defauls to OR";
396           type scaling-criteria-operation;
397           default OR;
398         }
399
400         leaf threshold-time {
401           description
402             "The duration for which the criteria must hold true";
403           type uint32;
404           mandatory true;
405         }
406
407         leaf cooldown-time {
408           description
409             "The duration after a scaling-in/scaling-out action has been
410             triggered, for which there will be no further optional";
411           type uint32;
412           mandatory true;
413         }
414
415         list scaling-criteria {
416           description
417               "list of conditions to be met for generating scaling
418                  requests";
419           key "name";
420
421           leaf name {
422             type string;
423           }
424
425           leaf scale-in-threshold {
426             description
427                 "Value below which scale-in requests are generated";
428             type uint64;
429           }
430
431           leaf scale-out-threshold {
432             description
433                 "Value above which scale-out requests are generated";
434             type uint64;
435           }
436
437           leaf ns-monitoring-param-ref {
438             description 
439                "Reference to the NS level monitoring parameter
440                 that is aggregated";
441             type leafref {
442               path "../../../../monitoring-param/id";
443             }
444           }
445         }
446       }
447
448       list vnfd-member {
449         description "List of VNFs in this scaling group";
450         key "member-vnf-index-ref";
451
452         leaf member-vnf-index-ref {
453           description "member VNF index of this member VNF";
454           type leafref {
455             path "../../../constituent-vnfd/member-vnf-index";
456           }
457         }
458
459         leaf count {
460           description
461             "count of this member VNF  within this scaling group.
462              The count allows to define  the number of instances
463              when a scaling action targets this scaling group";
464           type uint32;
465           default 1;
466         }
467       }
468
469       leaf min-instance-count {
470         description
471           "Minimum instances of the scaling group which are allowed.
472           These instances are created by default when the network service
473           is instantiated.";
474         type uint32;
475         default 0;
476       }
477
478       leaf max-instance-count {
479         description
480           "Maximum instances of this scaling group that are allowed
481            in a single network service. The network service scaling
482            will fail, when the number of service group instances
483            exceed the max-instance-count specified.";
484         type uint32;
485         default 10;
486       }
487
488       list scaling-config-action {
489         description "List of scaling config actions";
490         key "trigger";
491
492         leaf trigger {
493           description "scaling trigger";
494           type scaling-trigger;
495         }
496
497         leaf ns-config-primitive-name-ref {
498           description "Reference to the NS config name primitive";
499           type leafref {
500             path "../../../service-primitive/name";
501           }
502         }
503       }
504     }
505
506     list placement-groups {
507       description "List of placement groups at NS level";
508
509       key "name";
510       uses manotypes:placement-group-info;
511
512       list member-vnfd {
513         description
514             "List of VNFDs that are part of this placement group";
515
516         key "member-vnf-index-ref";
517
518         leaf member-vnf-index-ref {
519           description "member VNF index of this member VNF";
520           type leafref {
521             path "../../../constituent-vnfd/member-vnf-index";
522           }
523         }
524
525         leaf vnfd-id-ref {
526           description
527               "Identifier for the VNFD.";
528           type leafref {
529             path "../../../constituent-vnfd" + 
530                  "[member-vnf-index = current()/../member-vnf-index-ref]" +
531                  "/vnfd-id-ref";
532           }
533         }
534       }
535     }
536
537     uses manotypes:ip-profile-list;
538
539     list vnf-dependency {
540       description
541           "List of VNF dependencies.";
542       key vnf-source-ref;
543       leaf vnf-source-ref {
544         type leafref {
545           path "../../constituent-vnfd/vnfd-id-ref";
546         }
547       }
548       leaf vnf-depends-on-ref {
549         description
550             "Reference to VNF that sorce VNF depends.";
551         type leafref {
552           path "../../constituent-vnfd/vnfd-id-ref";
553         }
554       }
555     }
556
557     list vnffgd {
558       description
559           "List of VNF Forwarding Graph Descriptors (VNFFGD).";
560
561       key "id";
562
563       leaf id {
564         description
565             "Identifier for the VNFFGD.";
566         type string;
567       }
568
569       leaf name {
570         description
571             "VNFFGD name.";
572         type string;
573       }
574
575       leaf short-name {
576         description
577             "Short name to appear as label in the UI";
578         type string;
579       }
580
581       leaf vendor {
582         description "Provider of the VNFFGD.";
583         type string;
584       }
585
586       leaf description {
587         description "Description of the VNFFGD.";
588         type string;
589       }
590
591       leaf version {
592         description "Version of the VNFFGD";
593         type string;
594       }
595
596       list rsp {
597         description
598             "List of Rendered Service Paths (RSP).";
599
600         key "id";
601
602         leaf id {
603           description
604               "Identifier for the RSP.";
605           type string;
606         }
607
608         leaf name {
609           description
610               "RSP name.";
611           type string;
612         }
613
614         list vnfd-connection-point-ref {
615           description
616                 "A list of references to connection points.";
617           key "member-vnf-index-ref";
618
619           leaf member-vnf-index-ref {
620             description "Reference to member-vnf within constituent-vnfds";
621             type leafref {
622               path "../../../../constituent-vnfd/member-vnf-index";
623             }
624           }
625
626           leaf order {
627             type uint8;
628             description
629                 "A number that denotes the order of a VNF in a chain";
630           }
631
632            leaf vnfd-id-ref {
633              description
634                  "A reference to a vnfd";
635              type leafref {
636                 path "../../../../constituent-vnfd" +
637                      "[member-vnf-index = current()/../member-vnf-index-ref]" +
638                      "/vnfd-id-ref";
639              }
640            }
641
642            leaf vnfd-connection-point-ref {
643              description
644                  "A reference to a connection point name";
645              type leafref {
646                path "/vnfd:vnfd-catalog/vnfd:vnfd" +
647                     "[vnfd:id = current()/../vnfd-id-ref]/" +
648                     "vnfd:connection-point/vnfd:name";
649              }
650           }
651         }
652       } //rsp
653
654       list classifier {
655         description
656             "List of classifier rules.";
657
658         key "id";
659
660         leaf id {
661           description
662               "Identifier for the classifier rule.";
663           type string;
664         }
665
666         leaf name {
667           description
668               "Name of the classifier.";
669           type string;
670         }
671
672         leaf rsp-id-ref {
673           description
674               "A reference to the RSP.";
675           type leafref {
676             path "../../rsp/id";
677           }
678         }
679
680         leaf member-vnf-index-ref {
681           description "Reference to member-vnf within constituent-vnfds";
682           type leafref {
683             path "../../../constituent-vnfd/member-vnf-index";
684           }
685         }
686
687         leaf vnfd-id-ref {
688           description
689               "A reference to a vnfd";
690           type leafref {
691               path "../../../constituent-vnfd" +
692                    "[member-vnf-index = current()/../member-vnf-index-ref]" +
693                    "/vnfd-id-ref";
694           }
695         }
696
697         leaf vnfd-connection-point-ref {
698           description
699               "A reference to a connection point name";
700           type leafref {
701               path "/vnfd:vnfd-catalog/vnfd:vnfd" +
702                    "[vnfd:id = current()/../vnfd-id-ref]/" +
703                    "vnfd:connection-point/vnfd:name";
704           }
705         }
706
707         list match-attributes {
708           description
709               "List of match attributes.";
710
711           key "id";
712
713           leaf id {
714             description
715                 "Identifier for the classifier match attribute rule.";
716             type string;
717           }
718
719           leaf ip-proto {
720             description
721                 "IP Protocol.";
722             type uint8;
723           }
724
725           leaf source-ip-address {
726             description
727                 "Source IP address.";
728             type inet:ip-address;
729           }
730
731           leaf destination-ip-address {
732             description
733                 "Destination IP address.";
734             type inet:ip-address;
735           }
736
737           leaf source-port {
738             description
739                 "Source port number.";
740             type inet:port-number;
741           }
742
743           leaf destination-port {
744             description
745                 "Destination port number.";
746             type inet:port-number;
747           }
748           //TODO: Add more match criteria
749         } //match-attributes
750       } // classifier
751     } // vnffgd
752
753     list monitoring-param {
754       description
755         "List of monitoring parameters from VNF's that should be
756         propogated up into NSR";
757       key "id";
758
759       leaf id {
760         type string;
761       }
762
763       leaf name {
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 which must be
810          pulled from during 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 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 }