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