Adding support to different ingress and egress ports (SFC)
[osm/IM.git] / models / yang / nsd-base.yang
1
2 /*
3  * 
4  *   Copyright 2017 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-base
22 {
23   namespace "http://riftio.com/ns/riftware-1.0/nsd-base";
24   prefix "nsd-base";
25
26   import ietf-inet-types {
27     prefix "inet";
28   }
29
30   import mano-types {
31     prefix "manotypes";
32   }
33
34   import vnfd {
35     prefix "vnfd";
36   }
37
38   revision 2017-02-28 {
39     description
40       "Initial revision. This YANG file defines
41        the Network Service Descriptor (NSD)
42        common groupings";
43     reference
44       "Derived from earlier versions of base YANG files";
45   }
46
47   typedef scaling-trigger {
48     type enumeration {
49       enum pre-scale-in {
50         value 1;
51       }
52       enum post-scale-in {
53         value 2;
54       }
55       enum pre-scale-out {
56         value 3;
57       }
58       enum post-scale-out {
59         value 4;
60       }
61     }
62   }
63
64   typedef scaling-criteria-operation {
65     type enumeration {
66       enum AND {
67         value 1;
68       }
69       enum OR {
70         value 2;
71       }
72     }
73   }
74
75   grouping primitive-parameter {
76     leaf name {
77       description
78           "Name of the parameter.";
79       type string;
80     }
81
82     leaf data-type {
83       description
84           "Data type associated with the name.";
85       type manotypes:parameter-data-type;
86     }
87
88     leaf mandatory {
89       description "Is this field mandatory";
90       type boolean;
91       default false;
92     }
93
94     leaf default-value {
95       description "The default value for this field";
96       type string;
97     }
98
99     leaf parameter-pool {
100       description "NSD parameter pool name to use for this parameter";
101       type string;
102     }
103   } // primitive-parameter
104
105   grouping nsd-descriptor-common {
106     leaf id {
107       description "Identifier for the NSD.";
108       type string {
109         length 1..63;
110       }
111     }
112
113     leaf name {
114       description "NSD name.";
115       mandatory true;
116       type string;
117     }
118
119     leaf short-name {
120       description "Short name to appear as label in the UI";
121       type string;
122     }
123
124     leaf vendor {
125       description "Vendor of the NSD.";
126       type string;
127     }
128
129     leaf logo {
130       description
131         "File path for  the vendor specific logo. For example icons/mylogo.png.
132          The logo  should be part of the network service";
133       type string;
134     }
135
136     leaf description {
137       description "Description of the NSD.";
138       type string;
139     }
140
141     leaf version {
142       description "Version of the NSD";
143       type string;
144     }
145
146     list connection-point {
147       description
148           "List for external connection points.
149           Each NS has one or more external connection
150           points. As the name implies that external
151           connection points are used for connecting
152           the NS to other NS or to external networks.
153           Each NS exposes these connection points to
154           the orchestrator. The orchestrator can
155           construct network service chains by
156           connecting the connection points between
157           different NS.";
158
159       key "name";
160       uses nsd-connection-point-common;
161
162       leaf type {
163         description
164             "Type of the connection point.";
165         type manotypes:connection-point-type;
166       }
167
168       choice connection {
169         description "Logical connection of the CP to a VLD or to a VNF CP";
170
171         case vld-ref {
172
173           leaf vld-id-ref {
174             description
175               "ID reference to a VLD in the NS";
176             type leafref {
177               path "../../vld/id";
178             }
179           }
180
181         }
182
183         case vnfd-connection-point-ref {
184
185           leaf member-vnf-index-ref {
186             description "Reference to member-vnf within constituent-vnfd";
187             type leafref {
188               path "../../constituent-vnfd/member-vnf-index";
189             }
190           }
191
192           leaf vnfd-id-ref {
193             description
194               "A reference to a vnfd. This is a leafref to path:
195                   ../../nsd:constituent-vnfd
196                   + [nsd:id = current()/../nsd:id-ref]
197                   + /nsd:vnfd-id-ref";
198             type leafref {
199               path "../../constituent-vnfd" +
200                    "[member-vnf-index = current()/../member-vnf-index-ref]" +
201                    "/vnfd-id-ref";
202             }
203           }
204
205           leaf vnfd-connection-point-ref {
206             description
207               "A reference to a connection point name
208                   in a vnfd. This is a leafref to path:
209                       /vnfd:vnfd-catalog/vnfd:vnfd
210                       + [vnfd:id = current()/../nsd:vnfd-id-ref]
211                       + /vnfd:connection-point/vnfd:name";
212             type leafref {
213               path "/vnfd:vnfd-catalog/vnfd:vnfd" +
214                    "[vnfd:id = current()/../vnfd-id-ref]" +
215                    "/vnfd:connection-point/vnfd:name";
216             }
217           }
218
219         }
220
221       }
222
223     }
224
225     list scaling-group-descriptor {
226       description
227           "scaling group descriptor within this network service.
228            The scaling group defines a group of VNFs,
229            and the ratio of VNFs in the network service
230            that is used as target for scaling action";
231
232       key "name";
233
234       leaf name {
235         description "Name of this scaling group.";
236         type string;
237       }
238
239       list scaling-policy {
240
241         key "name";
242
243         leaf name {
244           description
245               "Name of the scaling policy";
246           type string;
247         }
248
249         leaf scaling-type {
250           description
251               "Type of scaling";
252           type manotypes:scaling-policy-type;
253         }
254
255         leaf enabled {
256           description
257             "Specifies if the scaling policy can be applied";
258           type boolean;
259           default true;
260         }
261
262         leaf scale-in-operation-type {
263           description
264               "Operation to be applied to check between scaling criterias to
265                check if the scale in threshold condition has been met.
266                Defaults to AND";
267           type manotypes:scaling-criteria-operation;
268           default AND;
269         }
270
271         leaf scale-out-operation-type {
272           description
273               "Operation to be applied to check between scaling criterias to
274                check if the scale out threshold condition has been met.
275                Defauls to OR";
276           type manotypes:scaling-criteria-operation;
277           default OR;
278         }
279
280         leaf threshold-time {
281           description
282             "The duration for which the criteria must hold true";
283           type uint32;
284           mandatory true;
285         }
286
287         leaf cooldown-time {
288           description
289             "The duration after a scaling-in/scaling-out action has been
290             triggered, for which there will be no further optional";
291           type uint32;
292           mandatory true;
293         }
294
295         list scaling-criteria {
296           description
297               "list of conditions to be met for generating scaling
298                  requests";
299           key "name";
300
301           leaf name {
302             type string;
303           }
304
305           leaf scale-in-threshold {
306             description
307                 "Value below which scale-in requests are generated";
308             type uint64;
309           }
310
311           leaf scale-in-relational-operation {
312             description
313               "The relational operator used to compare the monitoring param
314               against the scale-in-threshold.";
315             type manotypes:relational-operation-type;
316             default LE;
317           }
318
319           leaf scale-out-threshold {
320             description
321                 "Value above which scale-out requests are generated";
322             type uint64;
323           }
324
325           leaf scale-out-relational-operation {
326             description
327               "The relational operator used to compare the monitoring param
328               against the scale-out-threshold.";
329             type manotypes:relational-operation-type;
330             default GE;
331           }
332
333           leaf ns-monitoring-param-ref {
334             description
335                "Reference to the NS level monitoring parameter
336                 that is aggregated";
337             type leafref {
338               path "../../../../monitoring-param/id";
339             }
340           }
341         }
342       }
343
344       list vnfd-member {
345         description "List of VNFs in this scaling group";
346         key "member-vnf-index-ref";
347
348         leaf member-vnf-index-ref {
349           description "member VNF index of this member VNF";
350           type leafref {
351             path "../../../constituent-vnfd/member-vnf-index";
352           }
353         }
354
355         leaf count {
356           description
357             "count of this member VNF  within this scaling group.
358              The count allows to define  the number of instances
359              when a scaling action targets this scaling group";
360           type uint32;
361           default 1;
362         }
363       }
364
365       leaf min-instance-count {
366         description
367           "Minimum instances of the scaling group which are allowed.
368           These instances are created by default when the network service
369           is instantiated.";
370         type uint32;
371         default 0;
372       }
373
374       leaf max-instance-count {
375         description
376           "Maximum instances of this scaling group that are allowed
377            in a single network service. The network service scaling
378            will fail, when the number of service group instances
379            exceed the max-instance-count specified.";
380         type uint32;
381         default 10;
382       }
383
384       list scaling-config-action {
385         description "List of scaling config actions";
386         key "trigger";
387
388         leaf trigger {
389           description "scaling trigger";
390           type manotypes:scaling-trigger;
391         }
392
393         leaf ns-service-primitive-name-ref {
394           description "Reference to the NS service primitive";
395           type leafref {
396             path "../../../service-primitive/name";
397           }
398         }
399       }
400     }
401
402
403     list vnffgd {
404       description
405           "List of VNF Forwarding Graph Descriptors (VNFFGD).";
406
407       key "id";
408
409       uses fgd-common;
410
411       list rsp {
412         description
413           "List of Rendered Service Paths (RSP).";
414         key "id";
415
416         uses rsp-common;
417
418         list vnfd-connection-point-ref { // not common
419           description
420             "A list of references to connection points.";
421           key "member-vnf-index-ref";
422
423           leaf member-vnf-index-ref {
424             description "Reference to member-vnf within constituent-vnfds";
425             type leafref {
426               path "../../../../constituent-vnfd/member-vnf-index";
427             }
428           }
429
430           leaf order {
431             type uint8;
432             description
433               "A number that denotes the order of a VNF in a chain";
434           }
435
436           leaf vnfd-id-ref {
437             description
438               "A reference to a vnfd. This is a
439                   leafref to path:
440                       ../../../../nsd:constituent-vnfd
441                       + [nsd:id = current()/../nsd:id-ref]
442                       + /nsd:vnfd-id-ref";
443
444             type leafref {
445                 path "../../../../constituent-vnfd" +
446                     "[member-vnf-index = current()/../member-vnf-index-ref]" +
447                     "/vnfd-id-ref";
448             }
449           }
450
451           leaf vnfd-ingress-connection-point-ref {
452             description
453               "A reference to a connection point name
454                   in a vnfd. This is a leafref to path:
455                       /vnfd:vnfd-catalog/vnfd:vnfd
456                       + [vnfd:id = current()/../nsd:vnfd-id-ref]
457                       + /vnfd:connection-point/vnfd:name
458                   NOTE: An issue with confd is preventing the
459                   use of xpath. Seems to be an issue with leafref
460                   to leafref, whose target is in a different module.
461                   Once that is resolved this will switched to use
462                   leafref";
463             // TODO: Keeping as string as this needs to be
464             // diffenent lvel based of if it is nsd-catalog or
465             // in nsr.
466             // type leafref {
467             //   path "../../../../../../vnfd:vnfd-catalog/vnfd:vnfd" +
468             //        "[vnfd:id = current()/../vnfd-id-ref]/" +
469             //        "vnfd:connection-point/vnfd:name";
470             // }
471             type string;
472           }
473
474           leaf vnfd-egress-connection-point-ref {
475             description
476               "A reference to a connection point name
477                   in a vnfd. This is a leafref to path:
478                       /vnfd:vnfd-catalog/vnfd:vnfd
479                       + [vnfd:id = current()/../nsd:vnfd-id-ref]
480                       + /vnfd:connection-point/vnfd:name
481                   NOTE: An issue with confd is preventing the
482                   use of xpath. Seems to be an issue with leafref
483                   to leafref, whose target is in a different module.
484                   Once that is resolved this will switched to use
485                   leafref";
486             // TODO: Keeping as string as this needs to be
487             // diffenent lvel based of if it is nsd-catalog or
488             // in nsr.
489             // type leafref {
490             //   path "../../../../../../vnfd:vnfd-catalog/vnfd:vnfd" +
491             //        "[vnfd:id = current()/../vnfd-id-ref]/" +
492             //        "vnfd:connection-point/vnfd:name";
493             // }
494             type string;
495           }
496         }
497       } //rsp
498
499       list classifier {
500         description
501             "List of classifier rules.";
502
503         key "id";
504
505         uses classifier-common;
506
507         leaf member-vnf-index-ref {
508           description "Reference to member-vnf within constituent-vnfds";
509           type leafref {
510             path "../../../constituent-vnfd/member-vnf-index";
511           }
512         }
513
514         leaf vnfd-id-ref {
515           description
516               "A reference to a vnfd. This is a
517                   leafref to path:
518                       ../../../nsd:constituent-vnfd
519                       + [nsd:id = current()/../nsd:id-ref]
520                       + /nsd:vnfd-id-ref";
521
522           type leafref {
523               path "../../../constituent-vnfd" +
524                    "[member-vnf-index = current()/../member-vnf-index-ref]" +
525                    "/vnfd-id-ref";
526           }
527         }
528
529         leaf vnfd-connection-point-ref {
530           description
531               "A reference to a connection point name
532                   in a vnfd. This is a leafref to path:
533                       /vnfd:vnfd-catalog/vnfd:vnfd
534                       + [vnfd:id = current()/../nsd:vnfd-id-ref]
535                       + /vnfd:connection-point/vnfd:name
536                   NOTE: An issue with confd is preventing the
537                   use of xpath. Seems to be an issue with leafref
538                   to leafref, whose target is in a different module.
539                   Once that is resolved this will switched to use
540                   leafref";
541           // TODO: Keeping as string as this needs to be
542           // diffenent lvel based of if it is nsd-catalog or
543           // in nsr.
544           // type leafref {
545           //     path "../../../../../vnfd:vnfd-catalog/vnfd:vnfd" +
546           //          "[vnfd:id = current()/../vnfd-id-ref]/" +
547           //          "vnfd:connection-point/vnfd:name";
548           // }
549           type string;
550         }
551       } // classifier
552
553     } // vnffgd
554
555     uses manotypes:ip-profile-list;
556
557     list initial-service-primitive {
558       description
559         "Initial set of service primitives for NSD.";
560       key "seq";
561
562       uses manotypes:event-config;
563     }
564
565     list terminate-service-primitive {
566       description
567         "Set of service primitives during
568          termination for NSD.";
569       key "seq";
570
571       uses manotypes:event-config;
572     }
573
574     uses manotypes:input-parameter-xpath;
575
576     list parameter-pool {
577       description
578         "Pool of parameter values which must be
579          pulled from during configuration";
580       key "name";
581
582       leaf name {
583         description
584             "Name of the configuration value pool";
585         type string;
586       }
587
588       container range {
589         description
590             "Create a range of values to populate the pool with";
591
592         leaf start-value {
593           description
594               "Generated pool values start at this value";
595           type uint32;
596           mandatory true;
597         }
598
599         leaf end-value {
600           description
601               "Generated pool values stop at this value";
602           type uint32;
603           mandatory true;
604         }
605       }
606     }
607
608     list key-pair {
609       key "name";
610       description "Used to configure the list of public keys to be injected as part
611           of ns instantiation";
612
613       leaf name {
614         description "Name of this key pair";
615         type string;
616       }
617
618       leaf key {
619         description "Key associated with this key pair";
620         type string;
621       }
622     }
623
624     list user {
625       key "name";
626       description "List of users to be added through cloud-config";
627
628       leaf name {
629         description "Name of the user ";
630         type string;
631       }
632
633       leaf user-info {
634         description "The user name's real name";
635         type string;
636       }
637
638       list key-pair {
639         key "name";
640         description "Used to configure the list of public keys to be injected as part
641             of ns instantiation";
642
643         leaf name {
644           description "Name of this key pair";
645           type string;
646         }
647
648         leaf key {
649           description "Key associated with this key pair";
650           type string;
651         }
652       }
653     }
654   } // nsd-descriptor-common
655
656   grouping nsd-vld-common {
657     /* Still having issues modelling this,
658        see the comments under vnfd-connection-point-ref
659
660        IMPORTANT: Change description fields
661     */
662     uses vld-common;
663
664     choice init-params {
665       description "Extra parameters for VLD instantiation";
666
667       case vim-network-ref {
668         leaf vim-network-name {
669           description
670             "Name of network in VIM account. This is used to indicate
671                    pre-provisioned network name in cloud account.";
672           type string;
673         }
674       }
675
676       case vim-network-profile {
677         leaf ip-profile-ref {
678           description "Named reference to IP-profile object";
679           type leafref {
680             path "../../ip-profiles/name";
681           }
682         }
683       }
684
685     }
686   } // nsd-vld-common
687
688   grouping nsd-connection-point-common {
689     description "NSD connection point base";
690     //IMPORTANT: Change description fields
691     leaf name {
692       description
693           "Name of the connection point.";
694       type string;
695     }
696
697     leaf floating-ip-required {
698       description
699           "Boolean parameter to indicate whether the CP must be exposed.
700            A public IP address will be allocated to this CP if exposed is true.
701            The default is false meaning a floating IP address is not required.
702            It must be explicitly asked for a floating IP address to be allocated.";
703       type boolean;
704     }
705   } // nsd-connection-point-common
706
707   grouping vld-common {
708     description
709       "List of Virtual Link Descriptors.";
710
711     leaf id {
712       description
713         "Identifier for the VLD.";
714       type string;
715     }
716
717     leaf name {
718       description
719         "Virtual Link Descriptor (VLD) name.";
720       type string;
721     }
722
723     leaf short-name {
724       description
725         "Short name to appear as label in the UI";
726       type string;
727     }
728
729     leaf vendor {
730       description "Provider of the VLD.";
731       type string;
732     }
733
734     leaf description {
735       description "Description of the VLD.";
736       type string;
737     }
738
739     leaf version {
740       description "Version of the VLD";
741       type string;
742     }
743
744     leaf type {
745       type manotypes:virtual-link-type;
746     }
747
748     leaf root-bandwidth {
749       description
750         "For ELAN this is the aggregate bandwidth.";
751       type uint64;
752     }
753
754     leaf leaf-bandwidth {
755       description
756         "For ELAN this is the bandwidth of branches.";
757       type uint64;
758     }
759
760     // replicate for pnfd container here
761     uses manotypes:provider-network;
762
763     leaf mgmt-network {
764       description "Flag indicating whether this network is a VIM management network";
765       type boolean;
766       default false;
767     }
768   } // vld-common
769
770   grouping fgd-common {
771
772     leaf id {
773       description
774           "Identifier for the FGD.";
775       type string;
776     }
777
778     leaf name {
779       description
780           "FGD name.";
781       type string;
782     }
783
784     leaf short-name {
785       description
786           "Short name to appear as label in the UI";
787       type string;
788     }
789
790     leaf vendor {
791       description "Provider of the FGD.";
792       type string;
793     }
794
795     leaf description {
796       description "Description of the FGD.";
797       type string;
798     }
799
800     leaf version {
801       description "Version of the FGD";
802       type string;
803     }
804   } // fgd-common
805
806   grouping rsp-common {
807
808     leaf id {
809       description
810         "Identifier for the RSP.";
811       type string;
812     }
813
814     leaf name {
815       description
816         "RSP name.";
817       type string;
818     }
819
820   } // rsp-common
821
822   grouping classifier-common {
823
824     leaf id {
825       description
826           "Identifier for the classifier rule.";
827       type string;
828     }
829
830     leaf name {
831       description
832           "Name of the classifier.";
833       type string;
834     }
835
836     leaf rsp-id-ref {
837       description
838           "A reference to the RSP.";
839       type leafref {
840         path "../../rsp/id";
841       }
842     }
843
844     list match-attributes {
845       description
846           "List of match attributes.";
847
848       key "id";
849
850       leaf id {
851         description
852             "Identifier for the classifier match attribute rule.";
853         type string;
854       }
855
856       leaf ip-proto {
857         description
858             "IP Protocol.";
859         type uint8;
860       }
861
862       leaf source-ip-address {
863         description
864             "Source IP address.";
865         type inet:ip-address;
866       }
867
868       leaf destination-ip-address {
869         description
870             "Destination IP address.";
871         type inet:ip-address;
872       }
873
874       leaf source-port {
875         description
876             "Source port number.";
877         type inet:port-number;
878       }
879
880       leaf destination-port {
881         description
882             "Destination port number.";
883         type inet:port-number;
884       }
885       //TODO: Add more match criteria
886     } //match-attributes
887   } // classifier-common
888
889   grouping monitoring-param-common {
890     description
891       "List of monitoring parameters from VNF's that should be
892         propogated up into NSR";
893
894     leaf id {
895       type string;
896     }
897
898     leaf name {
899       type string;
900     }
901
902     uses manotypes:monitoring-param-value;
903     uses manotypes:monitoring-param-ui-data;
904     uses manotypes:monitoring-param-aggregation;
905   } // monitoring-param-common
906 }