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