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