New feature: Support rooted descriptors and descriptors under project
[osm/SO.git] / models / plugins / yang / nsr.yang
1
2 /*
3  * 
4  *   Copyright 2016-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 nsr
22 {
23   namespace "urn:ietf:params:xml:ns:yang:nfvo:nsr";
24   prefix "nsr";
25
26   import rw-pb-ext {
27     prefix "rwpb";
28   }
29
30   import vlr {
31     prefix "vlr";
32   }
33
34   import vld {
35     prefix "vld";
36   }
37
38   import nsd-base {
39     prefix "nsd-base";
40   }
41
42   import project-nsd {
43     prefix "project-nsd";
44   }
45
46   import project-vnfd {
47     prefix "project-vnfd";
48   }
49
50   import vnfr {
51     prefix "vnfr";
52   }
53
54   import ietf-inet-types {
55     prefix "inet";
56   }
57
58   import ietf-yang-types {
59     prefix "yang";
60   }
61
62   import mano-types {
63     prefix "manotypes";
64   }
65
66   import rw-sdn {
67     prefix "rw-sdn";
68   }
69
70   import rw-project {
71     prefix "rw-project";
72   }
73
74   revision 2017-02-08 {
75     description
76       "Update model to support projects.";
77   }
78
79   revision 2015-09-10 {
80     description
81       "Initial revision. This YANG file defines
82        the Network Service Record (NSR)";
83     reference
84       "Derived from earlier versions of base YANG files";
85   }
86
87   typedef config-states {
88     type enumeration {
89       enum init;
90       enum configuring;
91       enum config_not_needed;
92       enum configured;
93       enum failed;
94     }
95   }
96
97   typedef trigger-type {
98     type enumeration {
99       enum ns-primitive;
100       enum vnf-primitive;
101     }
102   }
103
104   augment "/rw-project:project" {
105     list key-pair {
106       key "name";
107       description "Used to configure the list of public keys to be injected as part
108                  of ns instantiation";
109       leaf name {
110         description "Name of this key pair";
111         type string;
112       }
113
114       leaf key {
115         description "Key associated with this key pair";
116         type string;
117       }
118     }
119   }
120
121   augment "/rw-project:project" {
122     container ns-instance-config {
123
124       list nsr {
125         key "id";
126         unique "name";
127
128         leaf id {
129           description "Identifier for the NSR.";
130           type yang:uuid;
131         }
132
133         leaf name {
134           description "NSR name.";
135           type string;
136         }
137
138         leaf short-name {
139           description "NSR short name.";
140           type string;
141         }
142
143         leaf description {
144           description "NSR description.";
145           type string;
146         }
147
148         leaf admin-status {
149           description
150             "This is the administrative status of the NS instance";
151
152           type enumeration {
153             enum ENABLED;
154             enum DISABLED;
155           }
156         }
157
158         container nsd {
159           description "NS descriptor used to instantiate this NS";
160
161           uses nsd-base:nsd-descriptor-common;
162
163           uses project-nsd:nsr-nsd-vld;
164
165           uses project-nsd:nsr-nsd-constituent-vnfd;
166
167           uses project-nsd:nsr-nsd-placement-groups;
168
169           uses project-nsd:nsr-nsd-vnf-dependency;
170
171           uses project-nsd:nsr-nsd-monitoring-param;
172         }
173
174         uses ns-instance-config-params;
175       }
176     }
177   }
178
179   grouping ns-instance-config-params-common {
180     uses manotypes:input-parameter;
181
182     list scaling-group {
183       description "List of ns scaling group instances";
184       key "scaling-group-name-ref";
185
186       leaf scaling-group-name-ref {
187         description "name of the scaling group
188         leafref path ../../nsd/scaling-group-descriptor/name";
189         type string;
190       }
191
192       list instance {
193         description "The instance of the scaling group";
194         key "id";
195         leaf id {
196           description "Scaling group instance uuid";
197           type uint16;
198         }
199       }
200     }
201
202     list nsd-placement-group-maps {
203       description
204           "Mapping from mano-placement groups construct from NSD to cloud
205           platform placement group construct";
206
207       key "placement-group-ref";
208
209       leaf placement-group-ref {
210         description "Reference for NSD placement group
211             leafref path ../../nsd/placement-groups/name";
212         type string;
213       }
214       uses manotypes:placement-group-input;
215     }
216   }
217
218   grouping ns-instance-config-params {
219     uses ns-instance-config-params-common;
220
221     list vnfd-placement-group-maps {
222       description
223         "Mapping from mano-placement groups construct from VNFD to cloud
224           platform placement group construct";
225
226       key "placement-group-ref vnfd-id-ref";
227
228       leaf vnfd-id-ref {
229         description
230           "A reference to a vnfd. This is a
231           leafref to path:
232           ../../../../project-nsd:constituent-vnfd
233           + [id = current()/../id-ref]
234           + /project-nsd:vnfd-id-ref
235           NOTE: An issue with confd is preventing the
236           use of xpath. Seems to be an issue with leafref
237           to leafref, whose target is in a different module.
238           Once that is resovled this will switched to use
239           leafref";
240         type yang:uuid;
241       }
242
243       leaf placement-group-ref {
244         description
245           "A reference to VNFD placement group";
246         type leafref {
247           path "../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd[project-vnfd:id = " +
248             "current()/../vnfd-id-ref]/project-vnfd:placement-groups/project-vnfd:name";
249         }
250       }
251
252       uses manotypes:placement-group-input;
253     }
254
255     list ssh-authorized-key {
256       key "key-pair-ref";
257
258       description "List of authorized ssh keys as part of cloud-config";
259
260       leaf key-pair-ref {
261         description "A reference to the key pair entry in the global key pair table";
262         type leafref {
263           path "../../../../key-pair/name";
264         }
265       }
266     }
267     list user {
268       key "name";
269
270       description "List of users to be added through cloud-config";
271       leaf name {
272         description "Name of the user ";
273         type string;
274       }
275
276       leaf user-info {
277         description "The user name's real name";
278         type string;
279       }
280
281       list ssh-authorized-key {
282         key "key-pair-ref";
283
284         description "Used to configure the list of public keys to be injected as part
285                         of ns instantiation";
286
287         leaf key-pair-ref {
288           description "A reference to the key pair entry in the global key pair table";
289           type leafref {
290             path "../../../../../key-pair/name";
291           }
292         }
293       }
294     }
295   }
296
297   grouping vnffgr {
298
299     list vnffgr {
300       key "id";
301
302       leaf id {
303         description "Identifier for the VNFFGR.";
304         type yang:uuid;
305       }
306
307       leaf vnffgd-id-ref {
308         description "VNFFG descriptor id reference";
309         type leafref {
310           // TODO: Fix leafref
311           path "../../../../ns-instance-config/nsr"
312             // + "[id=current()/../../ns-instance-config-ref]"
313             + "/nsd/vnffgd/id";
314         }
315       }
316
317       leaf vnffgd-name-ref {
318         description "VNFFG descriptor name reference";
319         // TODO: Fix leafref
320         type leafref {
321             path "../../../../ns-instance-config/nsr"
322               // + "[id=current()/../../ns-instance-config-ref]"
323               + "/nsd/vnffgd"
324               // + "[id=current()/../vnffgd-id-ref]"
325               + "/name";
326         }
327       }
328
329       leaf sdn-account {
330         description
331             "The SDN account to use when requesting resources for
332             this vnffgr";
333         type leafref {
334           path "../../../../rw-sdn:sdn/rw-sdn:account/rw-sdn:name";
335         }
336       }
337
338       leaf operational-status {
339         description
340           "The operational status of the VNFFGR instance
341             init                : The VNFFGR has just started.
342             running             : The VNFFGR is in running state.
343             terminate           : The VNFFGR is being terminated.
344             terminated          : The VNFFGR is in the terminated state.
345             failed              : The VNFFGR instantiation failed
346           ";
347
348         type enumeration {
349           rwpb:enum-type "VnffgrOperationalStatus";
350           enum init;
351           enum running;
352           enum terminate;
353           enum terminated;
354           enum failed;
355         }
356       }
357
358       list rsp {
359         key "id";
360
361         leaf id {
362           description
363               "Identifier for the RSP.";
364           type yang:uuid;
365         }
366
367         leaf name {
368           description
369               "Name for the RSP";
370           type string;
371         }
372
373         leaf vnffgd-rsp-id-ref {
374           description
375               "Identifier for the VNFFG Descriptor RSP reference";
376           // TODO: Fix leafref
377           type leafref {
378             path "../../../../../ns-instance-config/nsr"
379               // + "[id=current()/../../../ns-instance-config-ref]"
380               + "/nsd/vnffgd"
381               // + "[id=current()/../../vnffgd-id-ref]"
382               + "/rsp/id";
383           }
384         }
385
386         leaf vnffgd-rsp-name-ref {
387           description
388               "Name for the VNFFG Descriptor RSP reference";
389           // TODO: Fix leafref
390           type leafref {
391             path "../../../../../ns-instance-config/nsr"
392               // + "[id=current()/../../../ns-instance-config-ref]"
393               + "/nsd/vnffgd"
394               // + "[id=current()/../../vnffgd-id-ref]"
395               + "/rsp"
396               // + "[id=current()/../vnffgd-rsp-id-ref]"
397               + "/name";
398           }
399         }
400
401         leaf classifier-name {
402           type string;
403         }
404
405         leaf path-id {
406           description
407               "Unique Identifier for the service path";
408           type uint32;
409         }
410
411         list vnfr-connection-point-ref {
412           key "hop-number";
413           leaf hop-number {
414             description
415                 "Monotonically increasing number to show service path hop
416                 order";
417             type uint8;
418           }
419           leaf service-function-type {
420             description
421                 "Type of Service Function.
422                 NOTE: This needs to map with Service Function Type in ODL to
423                 support VNFFG. Service Function Type is manadatory param in ODL
424                 SFC. This is temporarily set to string for ease of use";
425             type string;
426           }
427
428           leaf member-vnf-index-ref {
429             type uint64;
430           }
431           leaf vnfd-id-ref {
432             description
433                 "Reference to VNF Descriptor Id";
434             type string;
435           }
436           leaf vnfr-id-ref {
437             description
438                 "A reference to a vnfr id";
439                 type leafref {
440                   path "../../../../../../vnfr:vnfr-catalog/vnfr:vnfr/vnfr:id";
441                 }
442           }
443           leaf vnfr-name-ref {
444             description
445                 "A reference to a vnfr name";
446                 type leafref {
447                   path "../../../../../../vnfr:vnfr-catalog/vnfr:vnfr/vnfr:name";
448                 }
449           }
450           leaf vnfr-connection-point-ref {
451             description
452                 "A reference to a vnfr connection point.";
453             type leafref {
454               path "../../../../../../vnfr:vnfr-catalog/vnfr:vnfr"
455                  + "[vnfr:id = current()/../vnfr-id-ref]"
456                  + "/vnfr:connection-point/vnfr:name";
457             }
458           }
459           leaf service-index {
460             description
461                 "Location within the service path";
462             type uint8;
463           }
464           container connection-point-params {
465             leaf mgmt-address {
466               type inet:ip-address;
467             }
468             leaf name {
469               type string;
470             }
471             leaf port-id {
472               rwpb:field-inline "true";
473               rwpb:field-string-max 64;
474               type string;
475             }
476             leaf vm-id {
477               rwpb:field-inline "true";
478               rwpb:field-string-max 64;
479               type string;
480             }
481             leaf address {
482               type inet:ip-address;
483             }
484             leaf port {
485               type inet:port-number;
486             }
487           }
488
489           container service-function-forwarder {
490             leaf name {
491               description
492                   "Service Function Forwarder name";
493               type string;
494             }
495             leaf ip-address {
496               description
497                   "Data Plane IP Address of the SFF";
498               type inet:ip-address;
499             }
500             leaf port {
501               description
502                   "Data Plane Port of the SFF";
503               type inet:port-number;
504             }
505           }
506         }
507       }
508
509       list classifier {
510           key "id";
511
512           leaf id {
513             description
514                 "Identifier for the classifier rule.";
515             type yang:uuid;
516           }
517           leaf name {
518             description
519                 "Name of the classifier.";
520             type string;
521           }
522           leaf rsp-id-ref {
523             description
524                 "A reference to the RSP.";
525             type leafref {
526               path "../../rsp/id";
527             }
528           }
529           leaf rsp-name {
530             description
531               "Name for the RSP";
532             type string;
533           }
534           leaf vnfr-id-ref {
535             description
536                 "A reference to a vnfr id";
537                 type leafref {
538                   path "../../../../../vnfr:vnfr-catalog/vnfr:vnfr/vnfr:id";
539                 }
540           }
541           leaf vnfr-name-ref {
542             description
543                 "A reference to a vnfr name";
544                 type leafref {
545                   path "../../../../../vnfr:vnfr-catalog/vnfr:vnfr/vnfr:name";
546                 }
547           }
548           leaf vnfr-connection-point-ref {
549             description
550                 "A reference to a vnfr connection point.";
551             type leafref {
552               path "../../../../../vnfr:vnfr-catalog/vnfr:vnfr"
553                  + "[vnfr:id = current()/../vnfr-id-ref]"
554                  + "/vnfr:connection-point/vnfr:name";
555             }
556           }
557           leaf port-id {
558             rwpb:field-inline "true";
559             rwpb:field-string-max 64;
560             type string;
561           }
562           leaf vm-id {
563             rwpb:field-inline "true";
564             rwpb:field-string-max 64;
565             type string;
566           }
567           leaf ip-address {
568             type string;
569           }
570           leaf sff-name {
571             type string;
572           }
573       }
574     }
575   }
576
577   augment "/rw-project:project" {
578     container ns-instance-opdata {
579       config false;
580
581       list nsr {
582         key "ns-instance-config-ref";
583
584         leaf ns-instance-config-ref {
585           type leafref {
586             path "../../../ns-instance-config/nsr/id";
587           }
588           // type yang:uuid;
589         }
590
591         leaf name-ref {
592           description "Network service name reference";
593           type leafref {
594             // TODO: Fix leafref
595             path "../../../ns-instance-config/nsr" +
596               // "[id=current()/../ns-instance-config-ref]" +
597               "/name";
598           }
599         }
600
601         leaf nsd-ref {
602           description "Network service descriptor id reference";
603           type leafref {
604             // TODO: fix leafref
605             path "../../../ns-instance-config/nsr"
606               // + "[id=current()/../ns-instance-config-ref]"
607               + "/nsd/id";
608           }
609         }
610
611         leaf nsd-name-ref {
612           description "Network service descriptor name reference";
613           // TODO: Fix leafref
614           type leafref {
615             path "../../../ns-instance-config/nsr"
616               // + "[id=current()/../ns-instance-config-ref]"
617               + "/nsd/name";
618           }
619         }
620
621         leaf create-time {
622           description
623             "Creation timestamp of this Network Service.
624           The timestamp is expressed as seconds
625           since unix epoch - 1970-01-01T00:00:00Z";
626
627           type uint32;
628         }
629
630         leaf uptime {
631           description
632             "Active period of this Network Service.
633           Uptime is expressed in seconds";
634
635           type uint32;
636         }
637
638         list connection-point {
639           description
640             "List for external connection points.
641             Each NS has one or more external connection points.
642             As the name implies that external connection points
643             are used for connecting the NS to other NS or to
644             external networks. Each NS exposes these connection
645             points to the orchestrator. The orchestrator can
646             construct network service chains by connecting the
647             connection points between different NS.";
648
649           key "name";
650           leaf name {
651             description
652               "Name of the NS connection point.";
653             type string;
654           }
655
656           leaf type {
657             description
658               "Type of the connection point.";
659             type manotypes:connection-point-type;
660           }
661         }
662
663         list vlr {
664           key "vlr-ref";
665           leaf vlr-ref {
666             description
667               "Reference to a VLR record in the VLR catalog";
668             type leafref {
669               path "../../../../vlr:vlr-catalog/vlr:vlr/vlr:id";
670             }
671           }
672
673
674           list vnfr-connection-point-ref {
675             description
676               "A list of references to connection points.";
677             key "vnfr-id";
678
679             leaf vnfr-id {
680               description "A reference to a vnfr";
681               type leafref {
682                 path "../../../../../vnfr:vnfr-catalog/vnfr:vnfr/vnfr:id";
683               }
684             }
685
686             leaf connection-point {
687               description
688                 "A reference to a connection point name in a vnfr";
689               type leafref {
690                 path "../../../../../vnfr:vnfr-catalog/vnfr:vnfr"
691                   + "[vnfr:id = current()/../vnfr-id]"
692                   + "/vnfr:connection-point/vnfr:name";
693               }
694             }
695           }
696         }
697
698         list constituent-vnfr-ref {
699           description
700             "List of VNFRs that are part of this
701              network service.";
702           key "vnfr-id";
703
704           leaf vnfr-id {
705             description
706               "Reference to the VNFR id
707                This should be a leafref to /vnfr:vnfr-catalog/vnfr:vnfr/vnfr:id
708                But due to confd bug (RIFT-9451), changing to string.";
709             type string;
710           }
711         }
712
713         list scaling-group-record {
714           description "List of scaling group records";
715           key "scaling-group-name-ref";
716
717           leaf scaling-group-name-ref {
718             description "name of the scaling group";
719             // TODO: Fix leafref
720             type leafref {
721               path "../../../../ns-instance-config/nsr"
722                 // + "[id=current()/../../ns-instance-config-ref]"
723                 + "/nsd/scaling-group-descriptor/name";
724             }
725           }
726
727           list instance {
728             description "Reference to scaling group instance record";
729             key "instance-id";
730             leaf instance-id {
731               description "Scaling group instance id";
732               type uint16;
733             }
734
735             leaf is-default {
736               description "Flag indicating whether this instance was part of
737                 default scaling group (and thus undeletable)";
738               type boolean;
739             }
740
741             leaf op-status {
742               description
743                 "The operational status of the NS instance
744                 init                : The scaling group has just started.
745                 vnf-init-phase      : The VNFs in the scaling group are being instantiated.
746                 running             : The scaling group  is in running state.
747                 terminate           : The scaling group is being terminated.
748                 vnf-terminate-phase : The VNFs in the scaling group are being terminated.
749                 terminated          : The scaling group  is in the terminated state.
750                 failed              : The scaling group instantiation failed.
751               ";
752
753               type enumeration {
754                 enum init;
755                 enum vnf-init-phase;
756                 enum running;
757                 enum terminate;
758                 enum vnf-terminate-phase;
759                 enum terminated;
760                 enum failed;
761               }
762             }
763
764             leaf config-status {
765               description
766                 "The configuration status of the scaling group instance
767                configuring : At least one of the VNFs in this scaling group instance
768                              is in configuring state
769                configured  : All the VNFs in this scaling group instance are
770                              configured or config-not-needed state
771                failed      : Configuring this scaling group instance failed
772               ";
773               type config-states;
774             }
775
776             leaf error-msg {
777               description
778                 "Reason for failure in configuration of this scaling instance";
779               type string;
780             }
781
782             leaf create-time {
783               description
784                 "Creation timestamp of this scaling group record.
785               The timestamp is expressed as seconds
786               since unix epoch - 1970-01-01T00:00:00Z";
787
788               type uint32;
789             }
790
791             leaf-list vnfrs {
792               description "Reference to VNFR within the scale instance";
793               type leafref {
794                 path "../../../constituent-vnfr-ref/vnfr-id";
795               }
796             }
797           }
798         }
799
800         uses vnffgr;
801
802         leaf operational-status {
803           description
804             "The operational status of the NS instance
805             init                : The network service has just started.
806             vl-init-phase       : The VLs in the NS are being instantiated.
807             vnf-init-phase      : The VNFs in the NS are being instantiated.
808             running             : The NS is in running state.
809             terminate           : The NS is being terminated.
810             vnf-terminate-phase : The NS is terminating the VNFs in the NS.
811             vl-terminate-phase  : The NS is terminating the VLs in the NS.
812             terminated          : The NS is in the terminated state.
813             failed              : The NS instantiation failed.
814             scaling-out         : The NS is scaling out
815             scaling-in          : The NS is scaling in
816             vl-instantiate      : The NS is initiating a new VL
817             vl-terminate        : The NS is terminating a VL
818           ";
819
820           type enumeration {
821             enum init;
822             enum vl-init-phase;
823             enum vnf-init-phase;
824             enum running;
825             enum terminate;
826             enum vnf-terminate-phase;
827             enum vl-terminate-phase;
828             enum terminated;
829             enum failed;
830             enum scaling-out;
831             enum scaling-in;
832             enum vl-instantiate;
833             enum vl-terminate;
834           }
835         }
836
837         leaf config-status {
838           description
839             "The configuration status of the NS instance
840             configuring: At least one of the VNFs in this instance is in configuring state
841             configured:  All the VNFs in this NS instance are configured or config-not-needed state
842           ";
843           type config-states;
844         }
845
846         uses manotypes:ns-service-primitive;
847
848         list initial-config-primitive {
849           rwpb:msg-new NsrInitialConfigPrimitive;
850           description
851             "Initial set of configuration primitives for NSD.";
852           key "seq";
853           leaf seq {
854             description
855               "Sequence number for the configuration primitive.";
856             type uint64;
857           }
858
859           leaf name {
860             description
861               "Name of the configuration primitive.";
862             type string;
863             mandatory "true";
864           }
865
866           leaf user-defined-script {
867             description
868               "A user defined script.";
869             type string;
870           }
871
872           list parameter {
873             key "name";
874             leaf name {
875               type string;
876             }
877
878             leaf value {
879               type string;
880             }
881           }
882         }
883
884
885         list monitoring-param {
886           description
887             "List of NS level params.";
888           key "id";
889
890           uses manotypes:monitoring-param-value;
891           uses manotypes:monitoring-param-ui-data;
892           uses manotypes:monitoring-param-aggregation;
893
894           leaf id {
895             type string;
896           }
897
898           leaf name {
899             type string;
900           }
901
902           leaf nsd-mon-param-ref {
903             description "Reference to the NSD monitoring param descriptor
904                        that produced this result";
905             // TODO: Fix leafref
906             type leafref {
907               path "../../../../project-nsd:nsd-catalog/project-nsd:nsd" +
908                 "[project-nsd:id = current()/../../nsd-ref]" +
909                 "/project-nsd:monitoring-param/project-nsd:id";
910             }
911           }
912
913           list vnfr-mon-param-ref {
914             description "A list of VNFR monitoring params associated with this monp";
915             key "vnfr-id-ref vnfr-mon-param-ref";
916
917             leaf vnfr-id-ref {
918               description
919                 "A reference to a vnfr. This is a
920                 leafref to path:
921                     /vnfr:vnfr-catalog/vnfr:vnfr/vnfr:id";
922
923               type yang:uuid;
924             }
925
926             leaf vnfr-mon-param-ref {
927               description "A reference to the VNFR monitoring param";
928               type leafref {
929                 path "../../../../../vnfr:vnfr-catalog/vnfr:vnfr"
930                   + "[vnfr:id = current()/../vnfr-id-ref]"
931                   + "/vnfr:monitoring-param/vnfr:id";
932               }
933             }
934           }
935         }
936
937         list config-agent-job {
938           key "job-id";
939
940           leaf job-id {
941             description "config agent job Identifier for the NS.";
942             type uint64;
943           }
944
945           leaf job-name {
946             description "Config agent job name";
947             type string;
948           }
949
950           leaf job-status {
951             description
952               "Job status to be set based on each VNF primitive execution,
953                pending  - if at least one VNF is in pending state
954                           and remaining VNFs are in success state.
955                Success  - if all VNF executions are in success state
956                failure  - if one of the VNF executions is failure";
957             type enumeration {
958               enum pending;
959               enum success;
960               enum failure;
961             }
962           }
963
964           leaf triggered-by {
965             description "The primitive is triggered from NS or VNF level";
966             type trigger-type;
967           }
968
969           leaf create-time {
970             description
971               "Creation timestamp of this Config Agent Job.
972             The timestamp is expressed as seconds
973             since unix epoch - 1970-01-01T00:00:00Z";
974
975             type uint32;
976           }
977
978           leaf job-status-details {
979             description "Config agent job status details, in case of errors";
980             type string;
981           }
982
983           uses manotypes:primitive-parameter-value;
984
985           list parameter-group {
986             description
987               "List of NS Primitive parameter groups";
988             key "name";
989             leaf name {
990               description
991                 "Name of the parameter.";
992               type string;
993             }
994
995             uses manotypes:primitive-parameter-value;
996           }
997
998           list vnfr {
999             key "id";
1000             leaf id {
1001               description "Identifier for the VNFR.";
1002               type yang:uuid;
1003             }
1004             leaf vnf-job-status {
1005               description
1006                 "Job status to be set based on each VNF primitive execution,
1007                  pending  - if at least one primitive is in pending state
1008                             and remaining primitives are in success state.
1009                  Success  - if all primitive executions are in success state
1010                  failure  - if one of the primitive executions is failure";
1011               type enumeration {
1012                 enum pending;
1013                 enum success;
1014                 enum failure;
1015               }
1016             }
1017
1018             list primitive {
1019               key "name";
1020               leaf name {
1021                 description "the name of the primitive";
1022                 type string;
1023               }
1024
1025               uses manotypes:primitive-parameter-value;
1026
1027               leaf execution-id {
1028                 description "Execution id of the primitive";
1029                 type string;
1030               }
1031               leaf execution-status {
1032                 description "status of the Execution";
1033                 type enumeration {
1034                   enum pending;
1035                   enum success;
1036                   enum failure;
1037                 }
1038               }
1039               leaf execution-error-details {
1040                 description "Error details if execution-status is failure";
1041                 type string;
1042               }
1043             }
1044           }
1045         }
1046       }
1047     }
1048   }
1049
1050   grouping rpc-common {
1051     uses manotypes:rpc-project-name;
1052
1053     leaf nsr_id_ref {
1054       description "Reference to NSR ID ref";
1055       type leafref {
1056         path "/rw-project:project[rw-project:name=current()/.." +
1057           "/project-name]/ns-instance-config/nsr/id";
1058       }
1059     }
1060   }
1061
1062   rpc get-ns-service-primitive-values {
1063     description "Get the service primitive parameter values";
1064
1065     input {
1066       leaf name {
1067         description "Name of the NS service primitive group";
1068         mandatory true;
1069         type string;
1070       }
1071
1072       uses rpc-common;
1073     }
1074
1075     output {
1076       list ns-parameter {
1077         description "Automatically generated parameter";
1078         key "name";
1079
1080         leaf name {
1081           description "Parameter name which should be pulled from a parameter pool";
1082           type string;
1083         }
1084         leaf value {
1085           description "Automatically generated value";
1086           type string;
1087         }
1088       }
1089
1090       list ns-parameter-group {
1091         description "Automatically generated parameters in parameter group";
1092         key "name";
1093         leaf name {
1094           description "Parameter group name";
1095           type string;
1096         }
1097         list parameter {
1098           description "Automatically generated group parameter";
1099           key "name";
1100
1101           leaf name {
1102             description "Parameter name which should be pulled from a parameter pool";
1103             type string;
1104           }
1105           leaf value {
1106             description "Automatically generated value";
1107             type string;
1108           }
1109         }
1110       }
1111
1112       list vnf-primitive-group {
1113         description
1114             "List of service primitives grouped by VNF.";
1115
1116         key "member-vnf-index-ref";
1117         leaf member-vnf-index-ref {
1118           description
1119               "Reference to member-vnf within constituent-vnfds";
1120           type uint64;
1121         }
1122
1123         leaf vnfd-id-ref {
1124           description
1125               "A reference to a vnfd. This is a
1126                leafref to path:
1127                    ../../../../project-nsd:constituent-vnfd
1128                    + [project-nsd:id = current()/../project-nsd:id-ref]
1129                    + /project-nsd:vnfd-id-ref
1130                NOTE: An issue with confd is preventing the
1131                use of xpath. Seems to be an issue with leafref
1132                to leafref, whose target is in a different module.
1133                Once that is resovled this will switched to use
1134                leafref";
1135
1136           type string;
1137         }
1138
1139         list primitive {
1140           key "index";
1141           leaf index {
1142             description "Index of this primitive";
1143             type uint32;
1144           }
1145
1146           leaf name {
1147             description "Name of the primitive associated with a value pool";
1148             type string;
1149           }
1150
1151           list parameter {
1152             description "Automatically generated parameter";
1153             key "name";
1154
1155             leaf name {
1156               description "Parameter name which should be pulled from a parameter pool";
1157               type string;
1158             }
1159             leaf value {
1160               description "Automatically generated value";
1161               type string;
1162             }
1163           }
1164         }
1165       }
1166     }
1167   }
1168
1169   rpc exec-ns-service-primitive {
1170     description "Executes a NS service primitive or script";
1171
1172     input {
1173       leaf name {
1174         description "Name of the primitive";
1175         type string;
1176       }
1177
1178       uses rpc-common;
1179
1180       leaf triggered-by {
1181         description "The primitive is triggered from NS or VNF level";
1182         type trigger-type;
1183         default ns-primitive;
1184       }
1185
1186       uses manotypes:primitive-parameter-value;
1187
1188       list parameter-group {
1189         description
1190             "List of NS Primitive parameter groups";
1191         key "name";
1192         leaf name {
1193           description
1194               "Name of the parameter.";
1195           type string;
1196         }
1197
1198         uses manotypes:primitive-parameter-value;
1199       }
1200
1201       list vnf-list {
1202         description
1203             "List of VNFs whose primitives are being set.";
1204         key "member_vnf_index_ref";
1205
1206         leaf member_vnf_index_ref {
1207           description "Member VNF index";
1208           type uint64;
1209         }
1210
1211         leaf vnfr-id-ref {
1212           description
1213               "A reference to a vnfr. This is a
1214                leafref to path";
1215           type yang:uuid;
1216         }
1217
1218         list vnf-primitive {
1219           description
1220               "List of service primitives supported by the
1221             configuration agent for this VNF.";
1222           key "index";
1223
1224           leaf index {
1225             description
1226                 "index of the service primitive.";
1227             type uint32;
1228           }
1229           leaf name {
1230             description
1231                 "Name of the service primitive.";
1232             type string;
1233           }
1234
1235           uses manotypes:primitive-parameter-value;
1236         }
1237       }
1238       leaf user-defined-script {
1239         description
1240             "A user defined script.";
1241         type string;
1242       }
1243     }
1244     output {
1245       leaf job-id {
1246         description "Job identifier for this RPC";
1247         type uint64;
1248       }
1249
1250       leaf name {
1251         description "Name of the service primitive";
1252         type string;
1253       }
1254
1255       uses rpc-common;
1256
1257       leaf triggered-by {
1258         description "The primitive is triggered from NS or VNF level";
1259         type trigger-type;
1260       }
1261
1262       leaf create-time {
1263         description
1264           "Creation timestamp of this config agent JOB.
1265           The timestamp is expressed as seconds
1266           since unix epoch - 1970-01-01T00:00:00Z";
1267
1268         type uint32;
1269       }
1270
1271       leaf job-status-details {
1272         description "Job status details, in case of any errors";
1273         type string;
1274       }
1275
1276       uses manotypes:primitive-parameter-value;
1277
1278       list parameter-group {
1279         description
1280             "List of NS Primitive parameter groups";
1281         key "name";
1282         leaf name {
1283           description
1284               "Name of the parameter.";
1285           type string;
1286         }
1287
1288         uses manotypes:primitive-parameter-value;
1289       }
1290
1291       list vnf-out-list {
1292         description
1293             "List of VNFs whose primitives were set.";
1294         key "member_vnf_index_ref";
1295
1296         leaf member_vnf_index_ref {
1297           description "Member VNF index";
1298           type uint64;
1299         }
1300         leaf vnfr-id-ref {
1301           description
1302               "A reference to a vnfr. This is a
1303                leafref to path";
1304           type yang:uuid;
1305         }
1306
1307         list vnf-out-primitive {
1308           description
1309               "List of service primitives supported by the
1310             configuration agent for this VNF.";
1311           key "index";
1312
1313           leaf index {
1314             description
1315                 "index of the service primitive.";
1316             type uint32;
1317           }
1318
1319           leaf name {
1320             description
1321                 "Name of the service primitive.";
1322             type string;
1323           }
1324
1325           uses manotypes:primitive-parameter-value;
1326
1327           leaf execution-id {
1328             description "Execution id of this primitive";
1329             type string;
1330           }
1331
1332           leaf execution-status {
1333             description "Status of the execution of this primitive";
1334             type string;
1335           }
1336
1337           leaf execution-error-details {
1338             description "Error details if execution-status is failed";
1339             type string;
1340           }
1341         }
1342       }
1343     }
1344   }
1345
1346   rpc exec-scale-in {
1347     description "Executes scale out request";
1348
1349     input {
1350       uses rpc-common;
1351
1352       leaf scaling-group-name-ref {
1353         description "name of the scaling group";
1354         type string;
1355       }
1356
1357       leaf instance-id {
1358         description "id of the scaling group";
1359         type uint64;
1360       }
1361
1362
1363     }
1364     output {
1365       leaf instance-id {
1366         description "id of the scaling group";
1367         type uint64;
1368       }
1369     }
1370   }
1371
1372   rpc exec-scale-out {
1373     description "Executes scale out request";
1374
1375     input {
1376       uses rpc-common;
1377
1378       leaf scaling-group-name-ref {
1379         description "name of the scaling group";
1380         type string;
1381       }
1382
1383       leaf instance-id {
1384         description "id of the scaling group";
1385         type uint64;
1386       }
1387     }
1388
1389     output {
1390      leaf instance-id {
1391         description "id of the scaling group";
1392         type uint64;
1393       }
1394     }
1395   }
1396
1397   rpc start-network-service {
1398     description "Start the network service";
1399     input {
1400       leaf name {
1401         mandatory true;
1402         description "Name of the Network Service";
1403         type string;
1404       }
1405
1406       uses rpc-common;
1407
1408       uses ns-instance-config-params-common;
1409
1410       list vnfd-placement-group-maps {
1411         description
1412           "Mapping from mano-placement groups construct from VNFD to cloud
1413           platform placement group construct";
1414
1415         key "placement-group-ref vnfd-id-ref";
1416
1417         leaf vnfd-id-ref {
1418           description
1419             "A reference to a vnfd. This is a
1420           leafref to path:
1421           ../../../../project-nsd:constituent-vnfd
1422           + [id = current()/../project-nsd:id-ref]
1423           + /project-nsd:vnfd-id-ref
1424           NOTE: An issue with confd is preventing the
1425           use of xpath. Seems to be an issue with leafref
1426           to leafref, whose target is in a different module.
1427           Once that is resovled this will switched to use
1428           leafref";
1429           type yang:uuid;
1430         }
1431
1432         leaf placement-group-ref {
1433           description
1434             "A reference to VNFD placement group";
1435           type leafref {
1436             path "/rw-project:project[rw-project:name=current()/" +
1437               "../../project-name]/project-vnfd:vnfd-catalog/project-vnfd:vnfd[project-vnfd:id = " +
1438               "current()/../vnfd-id-ref]/project-vnfd:placement-groups/project-vnfd:name";
1439           }
1440         }
1441
1442         uses manotypes:placement-group-input;
1443
1444         list ssh-authorized-key {
1445           key "key-pair-ref";
1446
1447           description "List of authorized ssh keys as part of cloud-config";
1448
1449           leaf key-pair-ref {
1450             description "A reference to the key pair entry in the global key pair table";
1451             type leafref {
1452               path "/rw-project:project[rw-project:name=current()/../../../" +
1453                 "project-name]/key-pair/name";
1454             }
1455           }
1456         }
1457
1458         list user {
1459           key "name";
1460
1461           description "List of users to be added through cloud-config";
1462           leaf name {
1463             description "Name of the user ";
1464             type string;
1465           }
1466           leaf user-info {
1467             description "The user name's real name";
1468             type string;
1469           }
1470           list ssh-authorized-key {
1471             key "key-pair-ref";
1472
1473             description "Used to configure the list of public keys to be injected as part
1474                         of ns instantiation";
1475
1476             leaf key-pair-ref {
1477               description "A reference to the key pair entry in the global key pair table";
1478               type leafref {
1479                 path "/rw-project:project[rw-project:name=current()/" +
1480                   "../../../../project-name]/key-pair/name";
1481               }
1482             }
1483           }
1484         }
1485       }
1486     }
1487
1488     output {
1489       leaf nsr-id {
1490         description "Automatically generated parameter";
1491         type yang:uuid;
1492       }
1493     }
1494   }
1495
1496 }