Rift.IO OSM R1 Initial Submission
[osm/UI.git] / skyquake / plugins / composer / src / schemas / yang / nsd.yang.src
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   container nsd-catalog {
76
77     list nsd {
78       key "id";
79
80       leaf id {
81         description "Identifier for the NSD.";
82         type string;
83       }
84
85       leaf name {
86         description "NSD name.";
87         mandatory true;
88         type string;
89       }
90
91       leaf short-name {
92         description "NSD short name.";
93         type string;
94       }
95
96
97       leaf vendor {
98         description "Vendor of the NSD.";
99         type string;
100       }
101
102       leaf logo {
103         description
104           "File path for  the vendor specific logo. For example icons/mylogo.png.
105            The logo  should be part of the network service";
106         type string;
107       }
108
109       leaf description {
110         description "Description of the NSD.";
111         type string;
112       }
113
114       leaf version {
115         description "Version of the NSD";
116         type string;
117       }
118
119       list connection-point {
120         description
121             "List for external connection points.
122             Each NS has one or more external connection
123             points. As the name implies that external
124             connection points are used for connecting
125             the NS to other NS or to external networks.
126             Each NS exposes these connection points to
127             the orchestrator. The orchestrator can
128             construct network service chains by
129             connecting the connection points between
130             different NS.";
131
132         key "name";
133         leaf name {
134           description
135               "Name of the NS connection point.";
136           type string;
137         }
138
139         leaf type {
140           description
141               "Type of the connection point.";
142           type manotypes:connection-point-type;
143         }
144       }
145
146       /* Still having issues modelling this,
147          see the comments under vnfd-connection-point-ref
148        */
149       list vld {
150         description
151             "List of Virtual Link Descriptors.";
152
153         key "id";
154
155         leaf id {
156           description
157               "Identifier for the VLD.";
158           type string;
159         }
160
161         leaf name {
162           description
163               "Virtual Link Descriptor (VLD) name.";
164           type string;
165         }
166
167         leaf short-name {
168           description
169               "Short name for VLD for UI";
170           type string;
171         }
172
173         leaf vendor {
174           description "Provider of the VLD.";
175           type string;
176         }
177
178         leaf description {
179           description "Description of the VLD.";
180           type string;
181         }
182
183         leaf version {
184           description "Version of the VLD";
185           type string;
186         }
187
188         leaf type {
189           type manotypes:virtual-link-type;
190         }
191
192         leaf root-bandwidth {
193           description
194               "For ELAN this is the aggregate bandwidth.";
195           type uint64;
196         }
197
198         leaf leaf-bandwidth {
199           description
200               "For ELAN this is the bandwidth of branches.";
201           type uint64;
202         }
203
204         list vnfd-connection-point-ref {
205           description
206               "A list of references to connection points.";
207           key "member-vnf-index-ref";
208
209           leaf member-vnf-index-ref {
210             description "Reference to member-vnf within constituent-vnfds";
211             type leafref {
212               path "../../../nsd:constituent-vnfd/nsd:member-vnf-index";
213             }
214           }
215
216            leaf vnfd-id-ref {
217              description
218                  "A reference to a vnfd. This is a
219                   leafref to path:
220                       ../../../nsd:constituent-vnfd
221                       + [nsd:id = current()/../nsd:id-ref]
222                       + /nsd:vnfd-id-ref
223                   NOTE: An issue with confd is preventing the
224                   use of xpath. Seems to be an issue with leafref
225                   to leafref, whose target is in a different module.
226                   Once that is resovled this will switched to use
227                   leafref";
228              type string;
229            }
230
231            leaf vnfd-connection-point-ref {
232              description
233                  "A reference to a connection point name
234                   in a vnfd. This is a leafref to path:
235                       /vnfd:vnfd-catalog/vnfd:vnfd
236                       + [vnfd:id = current()/../nsd:vnfd-id-ref]
237                       + /vnfd:connection-point/vnfd:name
238                   NOTE: An issue with confd is preventing the
239                   use of xpath. Seems to be an issue with leafref
240                   to leafref, whose target is in a different module.
241                   Once that is resovled this will switched to use
242                   leafref";
243               type string;
244           }
245         }
246
247         // replicate for pnfd container here
248         uses manotypes:provider-network;
249       }
250
251       list constituent-vnfd {
252         description
253             "List of VNFDs that are part of this
254             network service.";
255
256         key "member-vnf-index";
257
258         leaf member-vnf-index {
259           description
260             "Identifier/index for the VNFD. This separate id
261              is required to ensure that multiple VNFs can be
262              part of single NS";
263           type uint64;
264         }
265
266         leaf vnfd-id-ref {
267           description
268             "Identifier for the VNFD.";
269           type leafref {
270             path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
271           }
272         }
273
274         leaf start-by-default {
275           description
276             "VNFD is started as part of the NS instantiation";
277           type boolean;
278           default true;
279         }
280       }
281
282       list scaling-group-descriptor {
283         description
284             "scaling group descriptor within this network service.
285              The scaling group defines a group of VNFs,
286              and the ratio of VNFs in the network service
287              that is used as target for scaling action";
288
289         key "name";
290
291         leaf name {
292           description "Name of this scaling group.";
293           type string;
294         }
295
296         list vnfd-member {
297           description "List of VNFs in this scaling group";
298           key "member-vnf-index-ref";
299
300           leaf member-vnf-index-ref {
301             description "member VNF index of this member VNF";
302             type leafref {
303               path "../../../constituent-vnfd/member-vnf-index";
304             }
305           }
306
307           leaf count {
308             description
309               "count of this member VNF  within this scaling group.
310                The count allows to define  the number of instances
311                when a scaling action targets this scaling group";
312             type uint32;
313             default 1;
314           }
315         }
316
317         leaf min-instance-count {
318           description
319             "Minimum instances of the scaling group which are allowed.
320             These instances are created by default when the network service
321             is instantiated.";
322           type uint32;
323           default 0;
324         }
325
326         leaf max-instance-count {
327           description
328             "Maximum instances of this scaling group that are allowed
329              in a single network service. The network service scaling
330              will fail, when the number of service group instances
331              exceed the max-instance-count specified.";
332           type uint32;
333           default 10;
334         }
335
336         list scaling-config-action {
337           description "List of scaling config actions";
338           key "trigger";
339
340           leaf trigger {
341             description "scaling trigger";
342             type scaling-trigger;
343           }
344
345           leaf ns-config-primitive-name-ref {
346             description "Reference to the NS config name primitive";
347             type leafref {
348               path "../../../config-primitive/name";
349             }
350           }
351         }
352       }
353
354       list placement-groups {
355         description "List of placement groups at NS level";
356
357         key "name";
358         uses manotypes:placement-group-info;
359         
360         list member-vnfd {
361           description
362               "List of VNFDs that are part of this placement group";
363
364           key "member-vnf-index-ref";
365
366           leaf member-vnf-index-ref {
367             description "member VNF index of this member VNF";
368             type leafref {
369               path "../../../constituent-vnfd/member-vnf-index";
370             }
371           }
372
373           leaf vnfd-id-ref {
374             description
375                 "Identifier for the VNFD.";
376             type leafref {
377               path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
378             }
379           }
380         }
381       }
382
383       list vnf-dependency {
384         description
385             "List of VNF dependencies.";
386         key vnf-source-ref;
387         leaf vnf-source-ref {
388           type leafref {
389             path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
390           }
391         }
392         leaf vnf-depends-on-ref {
393           description
394               "Reference to VNF that sorce VNF depends.";
395           type leafref {
396             path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
397           }
398         }
399       }
400
401       list vnffgd {
402         description
403             "List of VNF Forwarding Graph Descriptors (VNFFGD).";
404
405         key "id";
406
407         leaf id {
408           description
409               "Identifier for the VNFFGD.";
410           type string;
411         }
412
413         leaf name {
414           description
415               "VNFFGD name.";
416           type string;
417         }
418
419         leaf short-name {
420           description
421               "Short name for VNFFGD for UI";
422           type string;
423         }
424
425         leaf vendor {
426           description "Provider of the VNFFGD.";
427           type string;
428         }
429
430         leaf description {
431           description "Description of the VNFFGD.";
432           type string;
433         }
434
435         leaf version {
436           description "Version of the VNFFGD";
437           type string;
438         }
439
440         list rsp {
441           description
442               "List of Rendered Service Paths (RSP).";
443
444           key "id";
445
446           leaf id {
447             description
448                 "Identifier for the RSP.";
449             type string;
450           }
451
452           leaf name {
453             description
454                 "RSP name.";
455             type string;
456           }
457
458           list vnfd-connection-point-ref {
459             description
460                   "A list of references to connection points.";
461             key "member-vnf-index-ref";
462
463             leaf member-vnf-index-ref {
464               description "Reference to member-vnf within constituent-vnfds";
465               type leafref {
466                 path "../../../../nsd:constituent-vnfd/nsd:member-vnf-index";
467               }
468             }
469
470             leaf order {
471               type uint8;
472               description
473                   "A number that denotes the order of a VNF in a chain";
474             }
475
476              leaf vnfd-id-ref {
477                description
478                    "A reference to a vnfd. This is a
479                     leafref to path:
480                         ../../../../nsd:constituent-vnfd
481                         + [nsd:id = current()/../nsd:id-ref]
482                         + /nsd:vnfd-id-ref
483                     NOTE: An issue with confd is preventing the
484                     use of xpath. Seems to be an issue with leafref
485                     to leafref, whose target is in a different module.
486                     Once that is resovled this will switched to use
487                     leafref";
488                type string;
489              }
490
491              leaf vnfd-connection-point-ref {
492                description
493                    "A reference to a connection point name
494                     in a vnfd. This is a leafref to path:
495                         /vnfd:vnfd-catalog/vnfd:vnfd
496                         + [vnfd:id = current()/../nsd:vnfd-id-ref]
497                         + /vnfd:connection-point/vnfd:name
498                     NOTE: An issue with confd is preventing the
499                     use of xpath. Seems to be an issue with leafref
500                     to leafref, whose target is in a different module.
501                     Once that is resovled this will switched to use
502                     leafref";
503                 type string;
504             }
505           }
506         } //rsp
507
508         list classifier {
509           description
510               "List of classifier rules.";
511
512           key "id";
513
514           leaf id {
515             description
516                 "Identifier for the classifier rule.";
517             type string;
518           }
519
520           leaf name {
521             description
522                 "Name of the classifier.";
523             type string;
524           }
525
526           leaf rsp-id-ref {
527             description
528                 "A reference to the RSP.";
529             type leafref {
530               path "../../nsd:rsp/nsd:id";
531             }
532           }
533
534           leaf member-vnf-index-ref {
535             description "Reference to member-vnf within constituent-vnfds";
536             type leafref {
537               path "../../../nsd:constituent-vnfd/nsd:member-vnf-index";
538             }
539           }
540
541           leaf vnfd-id-ref {
542             description
543                 "A reference to a vnfd. This is a
544                     leafref to path:
545                         ../../../nsd:constituent-vnfd
546                         + [nsd:id = current()/../nsd:id-ref]
547                         + /nsd:vnfd-id-ref
548                     NOTE: An issue with confd is preventing the
549                     use of xpath. Seems to be an issue with leafref
550                     to leafref, whose target is in a different module.
551                     Once that is resovled this will switched to use
552                     leafref";
553             type string;
554           }
555
556           leaf vnfd-connection-point-ref {
557             description
558                 "A reference to a connection point name
559                     in a vnfd. This is a leafref to path:
560                         /vnfd:vnfd-catalog/vnfd:vnfd
561                         + [vnfd:id = current()/../nsd:vnfd-id-ref]
562                         + /vnfd:connection-point/vnfd:name
563                     NOTE: An issue with confd is preventing the
564                     use of xpath. Seems to be an issue with leafref
565                     to leafref, whose target is in a different module.
566                     Once that is resovled this will switched to use
567                     leafref";
568             type string;
569           }
570
571           list match-attributes {
572             description
573                 "List of match attributes.";
574
575             key "id";
576
577             leaf id {
578               description
579                   "Identifier for the classifier match attribute rule.";
580               type string;
581             }
582
583             leaf ip-proto {
584               description
585                   "IP Protocol.";
586               type uint8;
587             }
588
589             leaf source-ip-address {
590               description
591                   "Source IP address.";
592               type inet:ip-address;
593             }
594
595             leaf destination-ip-address {
596               description
597                   "Destination IP address.";
598               type inet:ip-address;
599             }
600
601             leaf source-port {
602               description
603                   "Source port number.";
604               type inet:port-number;
605             }
606
607             leaf destination-port {
608               description
609                   "Destination port number.";
610               type inet:port-number;
611             }
612             //TODO: Add more match criteria
613           } //match-attributes
614         } // classifier
615       } // vnffgd
616
617       uses manotypes:monitoring-param;
618       uses manotypes:input-parameter-xpath;
619
620       list parameter-pool {
621         description
622           "Pool of parameter values which must be
623            pulled from during configuration";
624         key "name";
625
626         leaf name {
627           description
628               "Name of the configuration value pool";
629           type string;
630         }
631
632         container range {
633           description
634               "Create a range of values to populate the pool with";
635
636           leaf start-value {
637             description
638                 "Generated pool values start at this value";
639             type uint32;
640             mandatory true;
641           }
642
643           leaf end-value {
644             description
645                 "Generated pool values stop at this value";
646             type uint32;
647             mandatory true;
648           }
649         }
650       }
651
652       uses manotypes:config-primitive;
653     }
654   }
655 }