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