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