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