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