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