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