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