36e03a4424d15d9637dbade29cbc1a005a35394c
[osm/IM.git] / 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 nsd {
35     prefix "nsd";
36   }
37
38   import vnfd {
39     prefix "vnfd";
40   }
41
42   import vnfr {
43     prefix "vnfr";
44   }
45
46   import ietf-inet-types {
47     prefix "inet";
48   }
49
50   import ietf-yang-types {
51     prefix "yang";
52   }
53
54   import mano-types {
55     prefix "manotypes";
56   }
57
58   import rw-sdn {
59     prefix "rwsdn";
60   }
61
62   revision 2015-09-10 {
63     description
64       "Initial revision. This YANG file defines
65        the Network Service Record (NSR)";
66     reference
67       "Derived from earlier versions of base YANG files";
68   }
69
70   typedef config-states {
71     type enumeration {
72       enum init;
73       enum configuring;
74       enum config_not_needed;
75       enum configured;
76       enum failed;
77     }
78   }
79
80   typedef trigger-type {
81     type enumeration {
82       enum ns-primitive;
83       enum vnf-primitive;
84     }
85   }
86
87   grouping cloud-config {
88     description "List of cloud config parameters";
89
90     list ssh-authorized-key {
91       key "key-pair-ref";
92
93       description "List of authorized ssh keys as part of cloud-config";
94
95       leaf key-pair-ref {
96         description "A reference to the key pair entry in the global key pair table";
97         type leafref {
98           path "/nsr:key-pair/nsr:name";
99         }
100       }
101     }
102     list user {
103       key "name";
104
105       description "List of users to be added through cloud-config";
106       leaf name {
107         description "Name of the user ";
108         type string;
109       }
110       leaf user-info {
111         description "The user name's real name";
112         type string;
113       }
114       list ssh-authorized-key {
115         key "key-pair-ref";
116
117         description "Used to configure the list of public keys to be injected as part 
118                         of ns instantiation";
119
120         leaf key-pair-ref {
121           description "A reference to the key pair entry in the global key pair table";
122           type leafref {
123             path "/nsr:key-pair/nsr:name";
124           }
125         }
126       }
127     }
128   }
129
130   list key-pair {
131     key "name";
132     description "Used to configure the list of public keys to be injected as part
133                  of ns instantiation";
134     leaf name {
135       description "Name of this key pair";
136       type string;
137     }
138
139     leaf key {
140       description "Key associated with this key pair";
141       type string;
142     }
143   }
144
145   rpc start-network-service {
146     description "Start the network service";
147     input {
148       leaf name {
149         mandatory true;
150         description "Name of the Network Service";
151         type string;
152       }
153       leaf nsd-ref {
154         description "Reference to NSR ID ref";
155         mandatory true;
156         type leafref {
157           path "/nsd:nsd-catalog/nsd:nsd/nsd:id";
158         }
159       }
160       uses ns-instance-config-params;
161     }
162
163     output {
164       leaf nsr-id {
165         description "Automatically generated parameter";
166         type yang:uuid;
167       }
168     }
169   }
170
171
172
173   container ns-instance-config {
174
175     list nsr {
176       key "id";
177       unique "name";
178
179       leaf id {
180         description "Identifier for the NSR.";
181         type yang:uuid;
182       }
183
184       leaf name {
185         description "NSR name.";
186         type string;
187       }
188
189       leaf short-name {
190         description "NSR short name.";
191         type string;
192       }
193
194       leaf description {
195         description "NSR description.";
196         type string;
197       }
198
199       leaf admin-status {
200         description
201           "This is the administrative status of the NS instance";
202
203         type enumeration {
204           enum ENABLED;
205           enum DISABLED;
206         }
207       }
208
209       container nsd {
210         description "NS descriptor used to instantiate this NS";
211         uses nsd:nsd-descriptor;
212       }
213
214       uses ns-instance-config-params;
215     }
216   }
217
218   grouping ns-instance-config-params {
219     uses manotypes:input-parameter;
220
221     list scaling-group {
222       description "List of ns scaling group instances";
223       key "scaling-group-name-ref";
224
225       leaf scaling-group-name-ref {
226         description "name of the scaling group
227         leafref path ../../nsd/scaling-group-descriptor/name";
228         type string;
229       }
230
231       list instance {
232         description "The instance of the scaling group";
233         key "id";
234         leaf id {
235           description "Scaling group instance uuid";
236           type uint16;
237         }
238       }
239     }
240
241     list nsd-placement-group-maps {
242       description
243           "Mapping from mano-placement groups construct from NSD to cloud
244           platform placement group construct";
245
246       key "placement-group-ref";
247
248       leaf placement-group-ref {
249         description "Reference for NSD placement group
250             leafref path ../../nsd/placement-groups/name";
251         type string;
252       }
253       uses manotypes:placement-group-input;
254     }
255
256    list vnfd-placement-group-maps {
257       description
258           "Mapping from mano-placement groups construct from VNFD to cloud
259           platform placement group construct";
260
261     key "placement-group-ref vnfd-id-ref";
262
263     leaf vnfd-id-ref {
264       description
265           "A reference to a vnfd. This is a
266           leafref to path:
267           ../../../../nsd:constituent-vnfd
268           + [nsr:id = current()/../nsd:id-ref]
269           + /nsd:vnfd-id-ref
270           NOTE: confd limitations prevent the use of xpath";
271       type yang:uuid;
272     }
273
274     leaf placement-group-ref {
275       description
276           "A reference to VNFD placement group";
277       type leafref {
278         path "/vnfd:vnfd-catalog/vnfd:vnfd[vnfd:id = current()/" +
279             "../nsr:vnfd-id-ref]/vnfd:placement-groups/vnfd:name";
280       }
281     }
282
283     uses manotypes:placement-group-input;
284    }
285    uses cloud-config;
286   }
287
288   grouping vnffgr {
289
290     list vnffgr {
291       key "id";
292
293       leaf id {
294         description "Identifier for the VNFFGR.";
295         type yang:uuid;
296       }
297
298       leaf vnffgd-id-ref {
299         description "VNFFG descriptor id reference";
300         type leafref {
301           path "/nsr:ns-instance-config/nsr:nsr"
302             + "[nsr:id=current()/../../ns-instance-config-ref]"
303             + "/nsr:nsd/nsr:vnffgd/nsr:id";
304         }
305       }
306
307       leaf vnffgd-name-ref {
308         description "VNFFG descriptor name reference";
309         type leafref {
310             path "/ns-instance-config/nsr"
311               + "[id=current()/../../ns-instance-config-ref]"
312               + "/nsd/vnffgd[nsr:id = current()/../vnffgd-id-ref]"
313               + "/name";
314         }
315       }
316
317       leaf sdn-account {
318         description
319             "The SDN account to use when requesting resources for
320             this vnffgr";
321         type leafref {
322           path "/rwsdn:sdn/rwsdn:account/rwsdn:name";
323         }
324       }
325
326       leaf operational-status {
327         description
328           "The operational status of the VNFFGR instance
329             init                : The VNFFGR has just started.
330             running             : The VNFFGR is in running state.
331             terminate           : The VNFFGR is being terminated.
332             terminated          : The VNFFGR is in the terminated state.
333             failed              : The VNFFGR instantiation failed
334           ";
335
336         type enumeration {
337           rwpb:enum-type "VnffgrOperationalStatus";
338           enum init;
339           enum running;
340           enum terminate;
341           enum terminated;
342           enum failed;
343         }
344       }
345
346       list rsp {
347         key "id";
348
349         leaf id {
350           description
351               "Identifier for the RSP.";
352           type yang:uuid;
353         }
354
355         leaf name {
356           description
357               "Name for the RSP";
358           type string;
359         }
360
361         leaf vnffgd-rsp-id-ref {
362           description
363               "Identifier for the VNFFG Descriptor RSP reference";
364           type leafref {
365             path "/ns-instance-config/nsr"
366               + "[id=current()/../../../ns-instance-config-ref]"
367               + "/nsd/vnffgd"
368               + "[id=current()/../../vnffgd-id-ref]"
369               + "/rsp/id";
370           }
371         }
372
373         leaf vnffgd-rsp-name-ref {
374           description
375               "Name for the VNFFG Descriptor RSP reference";
376           type leafref {
377             path "/ns-instance-config/nsr:nsr"
378               + "[id=current()/../../../ns-instance-config-ref]"
379               + "/nsd/vnffgd"
380               + "[id=current()/../../vnffgd-id-ref]"
381               + "/rsp[id=current()/../vnffgd-rsp-id-ref]"
382               + "/name";
383           }
384         }
385
386         leaf classifier-name {
387           type string;
388         }
389
390         leaf path-id {
391           description
392               "Unique Identifier for the service path";
393           type uint32;
394         }
395
396         list vnfr-connection-point-ref {
397           key "hop-number";
398           leaf hop-number {
399             description
400                 "Monotonically increasing number to show service path hop
401                 order";
402             type uint8;
403           }
404           leaf service-function-type {
405             description
406                 "Type of Service Function.
407                 NOTE: This needs to map with Service Function Type in ODL to
408                 support VNFFG. Service Function Type is mandatory param in ODL
409                 SFC. This is temporarily set to string for ease of use";
410             type string;
411           }
412
413           leaf member-vnf-index-ref {
414             type uint64;
415           }
416           leaf vnfd-id-ref {
417             description
418                 "Reference to VNF Descriptor Id";
419             type string;
420           }
421           leaf vnfr-id-ref {
422             description
423                 "A reference to a vnfr id";
424                 type leafref {
425                   path "/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:id";
426                 }
427           }
428           leaf vnfr-name-ref {
429             description
430                 "A reference to a vnfr name";
431                 type leafref {
432                   path "/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:name";
433                 }
434           }
435           leaf vnfr-connection-point-ref {
436             description
437                 "A reference to a vnfr connection point.";
438             type leafref {
439               path "/vnfr:vnfr-catalog/vnfr:vnfr"
440                  + "[vnfr:id = current()/../nsr:vnfr-id-ref]"
441                  + "/vnfr:connection-point/vnfr:name";
442             }
443           }
444           leaf service-index {
445             description
446                 "Location within the service path";
447             type uint8;
448           }
449           container connection-point-params {
450             leaf mgmt-address {
451               type inet:ip-address;
452             }
453             leaf name {
454               type string;
455             }
456             leaf port-id {
457               rwpb:field-inline "true";
458               rwpb:field-string-max 64;
459               type string;
460             }
461             leaf vm-id {
462               rwpb:field-inline "true";
463               rwpb:field-string-max 64;
464               type string;
465             }
466             leaf address {
467               type inet:ip-address;
468             }
469             leaf port {
470               type inet:port-number;
471             }
472           }
473
474           container service-function-forwarder {
475             leaf name {
476               description
477                   "Service Function Forwarder name";
478               type string;
479             }
480             leaf ip-address {
481               description
482                   "Data Plane IP Address of the SFF";
483               type inet:ip-address;
484             }
485             leaf port {
486               description
487                   "Data Plane Port of the SFF";
488               type inet:port-number;
489             }
490           }
491         }
492       }
493
494       list classifier {
495           key "id";
496
497           leaf id {
498             description
499                 "Identifier for the classifier rule.";
500             type yang:uuid;
501           }
502           leaf name {
503             description
504                 "Name of the classifier.";
505             type string;
506           }
507           leaf rsp-id-ref {
508             description
509                 "A reference to the RSP.";
510             type leafref {
511               path "../../nsr:rsp/nsr:id";
512             }
513           }
514           leaf rsp-name {
515             description
516               "Name for the RSP";
517             type string;
518           }
519           leaf vnfr-id-ref {
520             description
521                 "A reference to a vnfr id";
522                 type leafref {
523                   path "/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:id";
524                 }
525           }
526           leaf vnfr-name-ref {
527             description
528                 "A reference to a vnfr name";
529                 type leafref {
530                   path "/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:name";
531                 }
532           }
533           leaf vnfr-connection-point-ref {
534             description
535                 "A reference to a vnfr connection point.";
536             type leafref {
537               path "/vnfr:vnfr-catalog/vnfr:vnfr"
538                  + "[vnfr:id = current()/../nsr:vnfr-id-ref]"
539                  + "/vnfr:connection-point/vnfr:name";
540             }
541           }
542           leaf port-id {
543             rwpb:field-inline "true";
544             rwpb:field-string-max 64;
545             type string;
546           }
547           leaf vm-id {
548             rwpb:field-inline "true";
549             rwpb:field-string-max 64;
550             type string;
551           }
552           leaf ip-address {
553             type string;
554           }
555           leaf sff-name {
556             type string;
557           }
558       }
559     }
560   }
561
562   container ns-instance-opdata {
563     config false;
564
565     list nsr {
566       key "ns-instance-config-ref";
567
568       leaf ns-instance-config-ref {
569         type leafref {
570           path "/nsr:ns-instance-config/nsr:nsr/nsr:id";
571         }
572       }
573
574       leaf name-ref {
575         description "Network service name reference";
576         type leafref {
577           path "/nsr:ns-instance-config/nsr:nsr/nsr:name";
578         }
579       }
580
581       leaf nsd-ref {
582         description "Network service descriptor id reference";
583         type leafref {
584           path "/ns-instance-config/nsr"
585             + "[id=current()/../ns-instance-config-ref]"
586             + "/nsd/id";
587         }
588       }
589
590       leaf nsd-name-ref {
591         description "Network service descriptor name reference";
592         type leafref {
593           path "/ns-instance-config/nsr"
594             + "[id=current()/../ns-instance-config-ref]"
595             + "/nsd/name";
596         }
597       }
598
599       leaf create-time {
600         description
601           "Creation timestamp of this Network Service.
602           The timestamp is expressed as seconds
603           since unix epoch - 1970-01-01T00:00:00Z";
604
605         type uint32;
606       }
607
608       leaf uptime {
609         description
610           "Active period of this Network Service.
611           Uptime is expressed in seconds";
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       list service-primitive {
825          description
826               "Network service level service primitives.";
827
828          key "name";
829
830          leaf name {
831             description
832                 "Name of the service primitive.";
833             type string;
834          }
835
836          list parameter {
837             description
838                 "List of parameters for the service primitive.";
839
840             key "name";
841             uses manotypes:primitive-parameter;
842          }
843
844          uses manotypes:ui-primitive-group;
845
846          list vnf-primitive-group {
847             description
848                 "List of service primitives grouped by VNF.";
849
850             key "member-vnf-index-ref";
851             leaf member-vnf-index-ref {
852               description
853                  "Reference to member-vnf within constituent-vnfds";
854               type uint64;
855             }
856
857             leaf vnfd-id-ref {
858                description
859                  "A reference to a vnfd. This is a 
860                   leafref to path:
861                       ../../../../nsd:constituent-vnfd
862                       + [nsd:id = current()/../nsd:id-ref]
863                       + /nsd:vnfd-id-ref
864                   NOTE: confd limitations prevent the use of xpath";
865
866                type string;
867             }
868
869             leaf vnfd-name {
870                description
871                  "Name of the VNFD";
872                type string;
873             }
874
875             list primitive {
876                key "index";
877
878                leaf index {
879                  description "Index of this primitive";
880                  type uint32;
881                }
882
883                leaf name {
884                  description "Name of the primitive in the VNF primitive ";
885                  type string;
886                }
887             }
888          }
889
890          leaf user-defined-script {
891            description
892                "A user defined script.";
893            type string;
894          }
895       }
896
897       list initial-config-primitive {
898         rwpb:msg-new NsrInitialConfigPrimitive;
899         description
900             "Initial set of configuration primitives for NSD.";
901         key "seq";
902         leaf seq {
903           description
904               "Sequence number for the configuration primitive.";
905           type uint64;
906         }
907
908         leaf name {
909           description
910               "Name of the configuration primitive.";
911           type string;
912           mandatory "true";
913         }
914
915         leaf user-defined-script {
916           description
917               "A user defined script.";
918           type string;
919         }
920
921         list parameter {
922           description
923               "List of parameters for the initial config primitive";
924           key "name";
925           leaf name {
926             description "Name of the intitial config parameter";
927             type string;
928           }
929
930           leaf value {
931             description "Value associated with the initial config 
932                         parameter";
933             type string;
934           }
935         }
936       }
937
938
939       list monitoring-param {
940         description
941           "List of NS level params.";
942         key "id";
943
944         uses manotypes:monitoring-param-value;
945         uses manotypes:monitoring-param-ui-data;
946         uses manotypes:monitoring-param-aggregation;
947
948         leaf id {
949           type string;
950         }
951
952         leaf name {
953           type string;
954         }
955
956         leaf nsd-mon-param-ref {
957           description "Reference to the NSD monitoring param descriptor
958                        that produced this result";
959           type leafref {
960             path "/nsd:nsd-catalog/nsd:nsd[nsd:id = current()/" +
961                  "../../nsr:nsd-ref]/nsd:monitoring-param/nsd:id";
962           }
963         }
964
965         list vnfr-mon-param-ref {
966           description "A list of VNFR monitoring params associated with this monp";
967           key "vnfr-id-ref vnfr-mon-param-ref";
968
969           leaf vnfr-id-ref {
970             description
971                "A reference to a vnfr. This is a
972                 leafref to path:
973                     /vnfr:vnfr-catalog/vnfr:vnfr/vnfr:id";
974
975             type yang:uuid;
976           }
977
978           leaf vnfr-mon-param-ref {
979             description "A reference to the VNFR monitoring param";
980             type leafref {
981               path "/vnfr:vnfr-catalog/vnfr:vnfr"
982                 + "[vnfr:id = current()/../nsr:vnfr-id-ref]"
983                 + "/vnfr:monitoring-param/vnfr:id";
984             }
985           }
986         }
987       }
988
989       list config-agent-job {
990         key "job-id";
991
992         leaf job-id {
993           description "config agent job Identifier for the NS.";
994           type uint64;
995         }
996
997         leaf job-name {
998           description "Config agent job name";
999           type string;
1000         }
1001
1002         leaf job-status {
1003           description
1004               "Job status to be set based on each VNF primitive execution,
1005                pending  - if at least one VNF is in pending state
1006                           and remaining VNFs are in success state.
1007                Success  - if all VNF executions are in success state
1008                failure  - if one of the VNF executions is failure";
1009           type enumeration {
1010             enum pending;
1011             enum success;
1012             enum failure;
1013           }
1014         }
1015
1016         leaf triggered-by {
1017           description "The primitive is triggered from NS or VNF level";
1018           type trigger-type;
1019         }
1020
1021         leaf create-time {
1022           description
1023             "Creation timestamp of this Config Agent Job.
1024             The timestamp is expressed as seconds
1025             since unix epoch - 1970-01-01T00:00:00Z";
1026
1027           type uint32;
1028         }
1029
1030         leaf job-status-details {
1031           description "Config agent job status details, in case of errors";
1032           type string;
1033         }
1034
1035         uses manotypes:primitive-parameter-value;
1036
1037         list parameter-group {
1038           description
1039               "List of NS Primitive parameter groups";
1040           key "name";
1041           leaf name {
1042             description
1043                 "Name of the parameter.";
1044             type string;
1045           }
1046
1047           uses manotypes:primitive-parameter-value;
1048         }
1049
1050         list vnfr {
1051           key "id";
1052           leaf id {
1053             description "Identifier for the VNFR.";
1054             type yang:uuid;
1055           }
1056           leaf vnf-job-status {
1057             description
1058                 "Job status to be set based on each VNF primitive execution,
1059                  pending  - if at least one primitive is in pending state
1060                             and remaining primitives are in success state.
1061                  Success  - if all primitive executions are in success state
1062                  failure  - if one of the primitive executions is failure";
1063             type enumeration {
1064               enum pending;
1065               enum success;
1066               enum failure;
1067             }
1068           }
1069
1070           list primitive {
1071             key "name";
1072             leaf name {
1073               description "the name of the primitive";
1074               type string;
1075             }
1076
1077             uses manotypes:primitive-parameter-value;
1078
1079             leaf execution-id {
1080               description "Execution id of the primitive";
1081               type string;
1082             }
1083             leaf execution-status {
1084               description "status of the Execution";
1085               type enumeration {
1086                 enum pending;
1087                 enum success;
1088                 enum failure;
1089               }
1090             }
1091             leaf execution-error-details {
1092               description "Error details if execution-status is failure";
1093               type string;
1094             }
1095           }
1096         }
1097       }
1098     }
1099   }
1100
1101   rpc get-ns-service-primitive-values {
1102     description "Get the service primitive parameter values";
1103     input {
1104       leaf nsr_id_ref {
1105         description "Reference to NSR ID ref";
1106         mandatory true;
1107         type leafref {
1108           path "/nsr:ns-instance-config/nsr:nsr/nsr:id";
1109         }
1110       }
1111
1112       leaf name {
1113         description "Name of the NS service primitive group";
1114         mandatory true;
1115         type string;
1116       }
1117     }
1118
1119     output {
1120       list ns-parameter {
1121         description "Automatically generated parameter";
1122         key "name";
1123
1124         leaf name {
1125           description "Parameter name which should be pulled from a parameter pool";
1126           type string;
1127         }
1128         leaf value {
1129           description "Automatically generated value";
1130           type string;
1131         }
1132       }
1133
1134       list ns-parameter-group {
1135         description "Automatically generated parameters in parameter group";
1136         key "name";
1137         leaf name {
1138           description "Parameter group name";
1139           type string;
1140         }
1141         list parameter {
1142           description "Automatically generated group parameter";
1143           key "name";
1144
1145           leaf name {
1146             description "Parameter name which should be pulled from a parameter pool";
1147             type string;
1148           }
1149           leaf value {
1150             description "Automatically generated value";
1151             type string;
1152           }
1153         }
1154       }
1155
1156       list vnf-primitive-group {
1157         description
1158             "List of service primitives grouped by VNF.";
1159
1160         key "member-vnf-index-ref";
1161         leaf member-vnf-index-ref {
1162           description
1163               "Reference to member-vnf within constituent-vnfds";
1164           type uint64;
1165         }
1166
1167         leaf vnfd-id-ref {
1168           description
1169               "A reference to a vnfd. This is a
1170                leafref to path:
1171                    ../../../../nsd:constituent-vnfd
1172                    + [nsd:id = current()/../nsd:id-ref]
1173                    + /nsd:vnfd-id-ref
1174                NOTE: confd limitations prevent the use of xpath";
1175
1176           type string;
1177         }
1178
1179         list primitive {
1180           key "index";
1181           leaf index {
1182             description "Index of this primitive";
1183             type uint32;
1184           }
1185
1186           leaf name {
1187             description "Name of the primitive associated with a value pool";
1188             type string;
1189           }
1190
1191           list parameter {
1192             description "Automatically generated parameter";
1193             key "name";
1194
1195             leaf name {
1196               description "Parameter name which should be pulled from a parameter pool";
1197               type string;
1198             }
1199             leaf value {
1200               description "Automatically generated value";
1201               type string;
1202             }
1203           }
1204         }
1205       }
1206     }
1207   }
1208
1209   rpc exec-ns-service-primitive {
1210     description "Executes a NS service primitive or script";
1211
1212     input {
1213       leaf name {
1214         description "Name of the primitive";
1215         type string;
1216       }
1217
1218       leaf nsr_id_ref {
1219         description "Reference to NSR ID ref";
1220         type leafref {
1221           path "/nsr:ns-instance-config/nsr:nsr/nsr:id";
1222         }
1223       }
1224
1225       leaf triggered-by {
1226         description "The primitive is triggered from NS or VNF level";
1227         type trigger-type;
1228         default ns-primitive;
1229       }
1230
1231       uses manotypes:primitive-parameter-value;
1232
1233       list parameter-group {
1234         description
1235             "List of NS Primitive parameter groups";
1236         key "name";
1237         leaf name {
1238           description
1239               "Name of the parameter.";
1240           type string;
1241         }
1242
1243         uses manotypes:primitive-parameter-value;
1244       }
1245
1246       list vnf-list {
1247         description
1248             "List of VNFs whose primitives are being set.";
1249         key "member_vnf_index_ref";
1250
1251         leaf member_vnf_index_ref {
1252           description "Member VNF index";
1253           type uint64;
1254         }
1255
1256         leaf vnfr-id-ref {
1257           description
1258               "A reference to a vnfr. This is a
1259                leafref to path";
1260           type yang:uuid;
1261         }
1262
1263         list vnf-primitive {
1264           description
1265               "List of service primitives supported by the
1266             configuration agent for this VNF.";
1267           key "index";
1268
1269           leaf index {
1270             description
1271                 "index of the service primitive.";
1272             type uint32;
1273           }
1274           leaf name {
1275             description
1276                 "Name of the service primitive.";
1277             type string;
1278           }
1279
1280           uses manotypes:primitive-parameter-value;
1281         }
1282       }
1283       leaf user-defined-script {
1284         description
1285             "A user defined script.";
1286         type string;
1287       }
1288     }
1289     output {
1290       leaf job-id {
1291         description "Job identifier for this RPC";
1292         type uint64;
1293       }
1294
1295       leaf name {
1296         description "Name of the service primitive";
1297         type string;
1298       }
1299
1300       leaf nsr_id_ref {
1301         description "Reference to NSR ID ref";
1302         type leafref {
1303           path "/nsr:ns-instance-config/nsr:nsr/nsr:id";
1304         }
1305       }
1306
1307       leaf triggered-by {
1308         description "The primitive is triggered from NS or VNF level";
1309         type trigger-type;
1310       }
1311
1312       leaf create-time {
1313         description
1314           "Creation timestamp of this config agent JOB.
1315           The timestamp is expressed as seconds
1316           since unix epoch - 1970-01-01T00:00:00Z";
1317
1318         type uint32;
1319       }
1320
1321       leaf job-status-details {
1322         description "Job status details, in case of any errors";
1323         type string;
1324       }
1325
1326       uses manotypes:primitive-parameter-value;
1327
1328       list parameter-group {
1329         description
1330             "List of NS Primitive parameter groups";
1331         key "name";
1332         leaf name {
1333           description
1334               "Name of the parameter.";
1335           type string;
1336         }
1337
1338         uses manotypes:primitive-parameter-value;
1339       }
1340
1341       list vnf-out-list {
1342         description
1343             "List of VNFs whose primitives were set.";
1344         key "member_vnf_index_ref";
1345
1346         leaf member_vnf_index_ref {
1347           description "Member VNF index";
1348           type uint64;
1349         }
1350         leaf vnfr-id-ref {
1351           description
1352               "A reference to a vnfr. This is a
1353                leafref to path";
1354           type yang:uuid;
1355         }
1356
1357         list vnf-out-primitive {
1358           description
1359               "List of service primitives supported by the
1360             configuration agent for this VNF.";
1361           key "index";
1362
1363           leaf index {
1364             description
1365                 "index of the service primitive.";
1366             type uint32;
1367           }
1368
1369           leaf name {
1370             description
1371                 "Name of the service primitive.";
1372             type string;
1373           }
1374
1375           uses manotypes:primitive-parameter-value;
1376
1377           leaf execution-id {
1378             description "Execution id of this primitive";
1379             type string;
1380           }
1381
1382           leaf execution-status {
1383             description "Status of the execution of this primitive";
1384             type string;
1385           }
1386
1387           leaf execution-error-details {
1388             description "Error details if execution-status is failed";
1389             type string;
1390           }
1391         }
1392       }
1393     }
1394   }
1395
1396   rpc exec-scale-in {
1397     description "Executes scale out request";
1398
1399     input {
1400
1401       leaf nsr-id-ref {
1402         description "Reference to NSR ID ref";
1403         type leafref {
1404           path "/nsr:ns-instance-config/nsr:nsr/nsr:id";
1405         }
1406       }
1407
1408       leaf scaling-group-name-ref {
1409         description "name of the scaling group";
1410         type string;
1411       }
1412
1413       leaf instance-id {
1414         description "id of the scaling group";
1415         type uint64;
1416       }
1417
1418
1419     }
1420     output {
1421       leaf instance-id {
1422         description "id of the scaling group";
1423         type uint64;
1424       }
1425     }
1426   }
1427
1428   rpc exec-scale-out {
1429     description "Executes scale out request";
1430
1431     input {
1432
1433       leaf nsr-id-ref {
1434         description "Reference to NSR ID ref";
1435         type leafref {
1436           path "/nsr:ns-instance-config/nsr:nsr/nsr:id";
1437         }
1438       }
1439
1440       leaf scaling-group-name-ref {
1441         description "name of the scaling group";
1442         type string;
1443       }
1444
1445       leaf instance-id {
1446         description "id of the scaling group";
1447         type uint64;
1448       }
1449
1450     }
1451     output {
1452      leaf instance-id {
1453         description "id of the scaling group";
1454         type uint64;
1455       }
1456     }
1457   }
1458
1459 }