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