Bug 94 - SDN and Cloud/Config-Agent account data inconsistent
[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/rwsdn: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       list connection-point {
617         description
618             "List for external connection points.
619             Each NS has one or more external connection points.
620             As the name implies that external connection points
621             are used for connecting the NS to other NS or to
622             external networks. Each NS exposes these connection
623             points to the orchestrator. The orchestrator can
624             construct network service chains by connecting the
625             connection points between different NS.";
626
627         key "name";
628         leaf name {
629           description
630               "Name of the NS connection point.";
631           type string;
632         }
633
634         leaf type {
635           description
636               "Type of the connection point.";
637           type manotypes:connection-point-type;
638         }
639       }
640
641       list vlr {
642         key "vlr-ref";
643         leaf vlr-ref {
644           description
645               "Reference to a VLR record in the VLR catalog";
646           type leafref {
647             path "/vlr:vlr-catalog/vlr:vlr/vlr:id";
648           }
649         }
650
651
652         list vnfr-connection-point-ref {
653           description
654             "A list of references to connection points.";
655           key "vnfr-id";
656
657           leaf vnfr-id {
658             description "A reference to a vnfr";
659             type leafref {
660               path "/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:id";
661             }
662           }
663
664           leaf connection-point {
665             description
666                 "A reference to a connection point name in a vnfr";
667             type leafref {
668               path "/vnfr:vnfr-catalog/vnfr:vnfr"
669                  + "[vnfr:id = current()/../nsr:vnfr-id]"
670                  + "/vnfr:connection-point/vnfr:name";
671             }
672           }
673         }
674       }
675
676       list constituent-vnfr-ref {
677         description
678             "List of VNFRs that are part of this
679              network service.";
680         key "vnfr-id";
681
682         leaf vnfr-id {
683           description
684             "Reference to the VNFR id
685              This should be a leafref to /vnfr:vnfr-catalog/vnfr:vnfr/vnfr:id
686              But due to confd bug (RIFT-9451), changing to string.
687             ";
688           type string;
689         }
690       }
691
692       list scaling-group-record {
693         description "List of scaling group records";
694         key "scaling-group-name-ref";
695
696         leaf scaling-group-name-ref {
697           description "name of the scaling group";
698           type leafref {
699             path "/ns-instance-config/nsr"
700               + "[id=current()/../../ns-instance-config-ref]"
701               + "/nsd/scaling-group-descriptor/name";
702           }
703         }
704
705         list instance {
706           description "Reference to scaling group instance record";
707           key "instance-id";
708           leaf instance-id {
709             description "Scaling group instance id";
710             type uint16;
711           }
712
713           leaf is-default {
714             description "Flag indicating whether this instance was part of
715                 default scaling group (and thus undeletable)";
716             type boolean;
717           }
718
719           leaf op-status {
720             description
721               "The operational status of the NS instance
722                 init                : The scaling group has just started.
723                 vnf-init-phase      : The VNFs in the scaling group are being instantiated.
724                 running             : The scaling group  is in running state.
725                 terminate           : The scaling group is being terminated.
726                 vnf-terminate-phase : The VNFs in the scaling group are being terminated.
727                 terminated          : The scaling group  is in the terminated state.
728                 failed              : The scaling group instantiation failed.
729               ";
730
731             type enumeration {
732               enum init;
733               enum vnf-init-phase;
734               enum running;
735               enum terminate;
736               enum vnf-terminate-phase;
737               enum terminated;
738               enum failed;
739             }
740           }
741
742           leaf config-status {
743             description
744               "The configuration status of the scaling group instance
745                configuring : At least one of the VNFs in this scaling group instance
746                              is in configuring state
747                configured  : All the VNFs in this scaling group instance are
748                              configured or config-not-needed state
749                failed      : Configuring this scaling group instance failed
750               ";
751             type config-states;
752           }
753
754           leaf error-msg {
755             description
756               "Reason for failure in configuration of this scaling instance";
757             type string;
758           }
759
760           leaf create-time {
761             description
762               "Creation timestamp of this scaling group record.
763               The timestamp is expressed as seconds
764               since unix epoch - 1970-01-01T00:00:00Z";
765
766               type uint32;
767           }
768
769           leaf-list vnfrs {
770             description "Reference to VNFR within the scale instance";
771             type leafref {
772               path "../../../constituent-vnfr-ref/vnfr-id";
773             }
774           }
775         }
776       }
777
778       uses vnffgr;
779
780       leaf operational-status {
781         description
782           "The operational status of the NS instance
783             init                : The network service has just started.
784             vl-init-phase       : The VLs in the NS are being instantiated.
785             vnf-init-phase      : The VNFs in the NS are being instantiated.
786             running             : The NS is in running state.
787             terminate           : The NS is being terminated.
788             vnf-terminate-phase : The NS is terminating the VNFs in the NS.
789             vl-terminate-phase  : The NS is terminating the VLs in the NS.
790             terminated          : The NS is in the terminated state.
791             failed              : The NS instantiation failed.
792             scaling-out         : The NS is scaling out
793             scaling-in          : The NS is scaling in
794             vl-instantiate      : The NS is initiating a new VL
795             vl-terminate        : The NS is terminating a VL
796           ";
797
798         type enumeration {
799           enum init;
800           enum vl-init-phase;
801           enum vnf-init-phase;
802           enum running;
803           enum terminate;
804           enum vnf-terminate-phase;
805           enum vl-terminate-phase;
806           enum terminated;
807           enum failed;
808           enum scaling-out;
809           enum scaling-in;
810           enum vl-instantiate;
811           enum vl-terminate;
812         }
813       }
814
815       leaf config-status {
816         description
817           "The configuration status of the NS instance
818             configuring: At least one of the VNFs in this instance is in configuring state
819             configured:  All the VNFs in this NS instance are configured or config-not-needed state
820           ";
821         type config-states;
822       }
823
824       uses manotypes:ns-service-primitive;
825
826       list initial-config-primitive {
827         rwpb:msg-new NsrInitialConfigPrimitive;
828         description
829             "Initial set of configuration primitives for NSD.";
830         key "seq";
831         leaf seq {
832           description
833               "Sequence number for the configuration primitive.";
834           type uint64;
835         }
836
837         leaf name {
838           description
839               "Name of the configuration primitive.";
840           type string;
841           mandatory "true";
842         }
843
844         leaf user-defined-script {
845           description
846               "A user defined script.";
847           type string;
848         }
849
850         list parameter {
851           key "name";
852           leaf name {
853             type string;
854           }
855
856           leaf value {
857             type string;
858           }
859         }
860       }
861
862
863       list monitoring-param {
864         description
865           "List of NS level params.";
866         key "id";
867
868         uses manotypes:monitoring-param-value;
869         uses manotypes:monitoring-param-ui-data;
870         uses manotypes:monitoring-param-aggregation;
871
872         leaf id {
873           type string;
874         }
875
876         leaf name {
877           type string;
878         }
879
880         leaf nsd-mon-param-ref {
881           description "Reference to the NSD monitoring param descriptor
882                        that produced this result";
883           type leafref {
884             path "/nsd:nsd-catalog/nsd:nsd[nsd:id = current()/" +
885                  "../../nsr:nsd-ref]/nsd:monitoring-param/nsd:id";
886           }
887         }
888
889         list vnfr-mon-param-ref {
890           description "A list of VNFR monitoring params associated with this monp";
891           key "vnfr-id-ref vnfr-mon-param-ref";
892
893           leaf vnfr-id-ref {
894             description
895                "A reference to a vnfr. This is a
896                 leafref to path:
897                     /vnfr:vnfr-catalog/vnfr:vnfr/vnfr:id";
898
899             type yang:uuid;
900           }
901
902           leaf vnfr-mon-param-ref {
903             description "A reference to the VNFR monitoring param";
904             type leafref {
905               path "/vnfr:vnfr-catalog/vnfr:vnfr"
906                 + "[vnfr:id = current()/../nsr:vnfr-id-ref]"
907                 + "/vnfr:monitoring-param/vnfr:id";
908             }
909           }
910         }
911       }
912
913       list config-agent-job {
914         key "job-id";
915
916         leaf job-id {
917           description "config agent job Identifier for the NS.";
918           type uint64;
919         }
920
921         leaf job-name {
922           description "Config agent job name";
923           type string;
924         }
925
926         leaf job-status {
927           description
928               "Job status to be set based on each VNF primitive execution,
929                pending  - if at least one VNF is in pending state
930                           and remaining VNFs are in success state.
931                Success  - if all VNF executions are in success state
932                failure  - if one of the VNF executions is failure";
933           type enumeration {
934             enum pending;
935             enum success;
936             enum failure;
937           }
938         }
939
940         leaf triggered-by {
941           description "The primitive is triggered from NS or VNF level";
942           type trigger-type;
943         }
944
945         leaf create-time {
946           description
947             "Creation timestamp of this Config Agent Job.
948             The timestamp is expressed as seconds
949             since unix epoch - 1970-01-01T00:00:00Z";
950
951           type uint32;
952         }
953
954         leaf job-status-details {
955           description "Config agent job status details, in case of errors";
956           type string;
957         }
958
959         uses manotypes:primitive-parameter-value;
960
961         list parameter-group {
962           description
963               "List of NS Primitive parameter groups";
964           key "name";
965           leaf name {
966             description
967                 "Name of the parameter.";
968             type string;
969           }
970
971           uses manotypes:primitive-parameter-value;
972         }
973
974         list vnfr {
975           key "id";
976           leaf id {
977             description "Identifier for the VNFR.";
978             type yang:uuid;
979           }
980           leaf vnf-job-status {
981             description
982                 "Job status to be set based on each VNF primitive execution,
983                  pending  - if at least one primitive is in pending state
984                             and remaining primitives are in success state.
985                  Success  - if all primitive executions are in success state
986                  failure  - if one of the primitive executions is failure";
987             type enumeration {
988               enum pending;
989               enum success;
990               enum failure;
991             }
992           }
993
994           list primitive {
995             key "name";
996             leaf name {
997               description "the name of the primitive";
998               type string;
999             }
1000
1001             uses manotypes:primitive-parameter-value;
1002
1003             leaf execution-id {
1004               description "Execution id of the primitive";
1005               type string;
1006             }
1007             leaf execution-status {
1008               description "status of the Execution";
1009               type enumeration {
1010                 enum pending;
1011                 enum success;
1012                 enum failure;
1013               }
1014             }
1015             leaf execution-error-details {
1016               description "Error details if execution-status is failure";
1017               type string;
1018             }
1019           }
1020         }
1021       }
1022     }
1023   }
1024
1025   rpc get-ns-service-primitive-values {
1026     description "Get the service primitive parameter values";
1027     input {
1028       leaf nsr_id_ref {
1029         description "Reference to NSR ID ref";
1030         mandatory true;
1031         type leafref {
1032           path "/nsr:ns-instance-config/nsr:nsr/nsr:id";
1033         }
1034       }
1035
1036       leaf name {
1037         description "Name of the NS service primitive group";
1038         mandatory true;
1039         type string;
1040       }
1041     }
1042
1043     output {
1044       list ns-parameter {
1045         description "Automatically generated parameter";
1046         key "name";
1047
1048         leaf name {
1049           description "Parameter name which should be pulled from a parameter pool";
1050           type string;
1051         }
1052         leaf value {
1053           description "Automatically generated value";
1054           type string;
1055         }
1056       }
1057
1058       list ns-parameter-group {
1059         description "Automatically generated parameters in parameter group";
1060         key "name";
1061         leaf name {
1062           description "Parameter group name";
1063           type string;
1064         }
1065         list parameter {
1066           description "Automatically generated group parameter";
1067           key "name";
1068
1069           leaf name {
1070             description "Parameter name which should be pulled from a parameter pool";
1071             type string;
1072           }
1073           leaf value {
1074             description "Automatically generated value";
1075             type string;
1076           }
1077         }
1078       }
1079
1080       list vnf-primitive-group {
1081         description
1082             "List of service primitives grouped by VNF.";
1083
1084         key "member-vnf-index-ref";
1085         leaf member-vnf-index-ref {
1086           description
1087               "Reference to member-vnf within constituent-vnfds";
1088           type uint64;
1089         }
1090
1091         leaf vnfd-id-ref {
1092           description
1093               "A reference to a vnfd. This is a
1094                leafref to path:
1095                    ../../../../nsd:constituent-vnfd
1096                    + [nsd:id = current()/../nsd:id-ref]
1097                    + /nsd:vnfd-id-ref
1098                NOTE: An issue with confd is preventing the
1099                use of xpath. Seems to be an issue with leafref
1100                to leafref, whose target is in a different module.
1101                Once that is resovled this will switched to use
1102                leafref";
1103
1104           type string;
1105         }
1106
1107         list primitive {
1108           key "index";
1109           leaf index {
1110             description "Index of this primitive";
1111             type uint32;
1112           }
1113
1114           leaf name {
1115             description "Name of the primitive associated with a value pool";
1116             type string;
1117           }
1118
1119           list parameter {
1120             description "Automatically generated parameter";
1121             key "name";
1122
1123             leaf name {
1124               description "Parameter name which should be pulled from a parameter pool";
1125               type string;
1126             }
1127             leaf value {
1128               description "Automatically generated value";
1129               type string;
1130             }
1131           }
1132         }
1133       }
1134     }
1135   }
1136
1137   rpc exec-ns-service-primitive {
1138     description "Executes a NS service primitive or script";
1139
1140     input {
1141       leaf name {
1142         description "Name of the primitive";
1143         type string;
1144       }
1145
1146       leaf nsr_id_ref {
1147         description "Reference to NSR ID ref";
1148         type leafref {
1149           path "/nsr:ns-instance-config/nsr:nsr/nsr:id";
1150         }
1151       }
1152
1153       leaf triggered-by {
1154         description "The primitive is triggered from NS or VNF level";
1155         type trigger-type;
1156         default ns-primitive;
1157       }
1158
1159       uses manotypes:primitive-parameter-value;
1160
1161       list parameter-group {
1162         description
1163             "List of NS Primitive parameter groups";
1164         key "name";
1165         leaf name {
1166           description
1167               "Name of the parameter.";
1168           type string;
1169         }
1170
1171         uses manotypes:primitive-parameter-value;
1172       }
1173
1174       list vnf-list {
1175         description
1176             "List of VNFs whose primitives are being set.";
1177         key "member_vnf_index_ref";
1178
1179         leaf member_vnf_index_ref {
1180           description "Member VNF index";
1181           type uint64;
1182         }
1183
1184         leaf vnfr-id-ref {
1185           description
1186               "A reference to a vnfr. This is a
1187                leafref to path";
1188           type yang:uuid;
1189         }
1190
1191         list vnf-primitive {
1192           description
1193               "List of service primitives supported by the
1194             configuration agent for this VNF.";
1195           key "index";
1196
1197           leaf index {
1198             description
1199                 "index of the service primitive.";
1200             type uint32;
1201           }
1202           leaf name {
1203             description
1204                 "Name of the service primitive.";
1205             type string;
1206           }
1207
1208           uses manotypes:primitive-parameter-value;
1209         }
1210       }
1211       leaf user-defined-script {
1212         description
1213             "A user defined script.";
1214         type string;
1215       }
1216     }
1217     output {
1218       leaf job-id {
1219         description "Job identifier for this RPC";
1220         type uint64;
1221       }
1222
1223       leaf name {
1224         description "Name of the service primitive";
1225         type string;
1226       }
1227
1228       leaf nsr_id_ref {
1229         description "Reference to NSR ID ref";
1230         type leafref {
1231           path "/nsr:ns-instance-config/nsr:nsr/nsr:id";
1232         }
1233       }
1234
1235       leaf triggered-by {
1236         description "The primitive is triggered from NS or VNF level";
1237         type trigger-type;
1238       }
1239
1240       leaf create-time {
1241         description
1242           "Creation timestamp of this config agent JOB.
1243           The timestamp is expressed as seconds
1244           since unix epoch - 1970-01-01T00:00:00Z";
1245
1246         type uint32;
1247       }
1248
1249       leaf job-status-details {
1250         description "Job status details, in case of any errors";
1251         type string;
1252       }
1253
1254       uses manotypes:primitive-parameter-value;
1255
1256       list parameter-group {
1257         description
1258             "List of NS Primitive parameter groups";
1259         key "name";
1260         leaf name {
1261           description
1262               "Name of the parameter.";
1263           type string;
1264         }
1265
1266         uses manotypes:primitive-parameter-value;
1267       }
1268
1269       list vnf-out-list {
1270         description
1271             "List of VNFs whose primitives were set.";
1272         key "member_vnf_index_ref";
1273
1274         leaf member_vnf_index_ref {
1275           description "Member VNF index";
1276           type uint64;
1277         }
1278         leaf vnfr-id-ref {
1279           description
1280               "A reference to a vnfr. This is a
1281                leafref to path";
1282           type yang:uuid;
1283         }
1284
1285         list vnf-out-primitive {
1286           description
1287               "List of service primitives supported by the
1288             configuration agent for this VNF.";
1289           key "index";
1290
1291           leaf index {
1292             description
1293                 "index of the service primitive.";
1294             type uint32;
1295           }
1296
1297           leaf name {
1298             description
1299                 "Name of the service primitive.";
1300             type string;
1301           }
1302
1303           uses manotypes:primitive-parameter-value;
1304
1305           leaf execution-id {
1306             description "Execution id of this primitive";
1307             type string;
1308           }
1309
1310           leaf execution-status {
1311             description "Status of the execution of this primitive";
1312             type string;
1313           }
1314
1315           leaf execution-error-details {
1316             description "Error details if execution-status is failed";
1317             type string;
1318           }
1319         }
1320       }
1321     }
1322   }
1323
1324   rpc exec-scale-in {
1325     description "Executes scale out request";
1326
1327     input {
1328
1329       leaf nsr-id-ref {
1330         description "Reference to NSR ID ref";
1331         type leafref {
1332           path "/nsr:ns-instance-config/nsr:nsr/nsr:id";
1333         }
1334       }
1335
1336       leaf scaling-group-name-ref {
1337         description "name of the scaling group";
1338         type string;
1339       }
1340
1341       leaf instance-id {
1342         description "id of the scaling group";
1343         type uint64;
1344       }
1345
1346
1347     }
1348     output {
1349       leaf instance-id {
1350         description "id of the scaling group";
1351         type uint64;
1352       }
1353     }
1354   }
1355
1356   rpc exec-scale-out {
1357     description "Executes scale out request";
1358
1359     input {
1360
1361       leaf nsr-id-ref {
1362         description "Reference to NSR ID ref";
1363         type leafref {
1364           path "/nsr:ns-instance-config/nsr:nsr/nsr:id";
1365         }
1366       }
1367
1368       leaf scaling-group-name-ref {
1369         description "name of the scaling group";
1370         type string;
1371       }
1372
1373       leaf instance-id {
1374         description "id of the scaling group";
1375         type uint64;
1376       }
1377
1378     }
1379     output {
1380      leaf instance-id {
1381         description "id of the scaling group";
1382         type uint64;
1383       }
1384     }
1385   }
1386
1387 }