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