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