48ac592ccadbf81b8a5795cf485e01460206a985
[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         leaf config-status {
886           description
887             "The configuration status of the NS instance
888             configuring: At least one of the VNFs in this instance is in configuring state
889             configured:  All the VNFs in this NS instance are configured or config-not-needed state
890           ";
891           type config-states;
892         }
893
894         list service-primitive {
895            description
896                 "Network service level service primitives.";
897
898            key "name";
899
900            leaf name {
901               description
902                   "Name of the service primitive.";
903               type string;
904            }
905
906            list parameter {
907               description
908                   "List of parameters for the service primitive.";
909
910               key "name";
911               uses manotypes:primitive-parameter;
912            }
913
914            uses manotypes:ui-primitive-group;
915
916            list vnf-primitive-group {
917               description
918                 "Reference to member-vnf within constituent-vnfds";
919
920               key "member-vnf-index-ref";
921               leaf member-vnf-index-ref {
922                 description
923                    "Reference to member-vnf within constituent-vnfds";
924                 type string;
925               }
926
927               leaf vnfd-id-ref {
928                  description
929                    "A reference to a vnfd. This is a 
930                     leafref to path:
931                         ../../../../nsd:constituent-vnfd
932                         + [nsd:id = current()/../nsd:id-ref]
933                         + /nsd:vnfd-id-ref
934                     NOTE: An issue with confd is preventing the
935                     use of xpath. Seems to be an issue with leafref
936                     to leafref, whose target is in a different module.
937                     Once that is resovled this will switched to use
938                     leafref";
939
940                  type string;
941               }
942
943               leaf vnfd-name {
944                  description
945                    "Name of the VNFD";
946                  type string;
947               }
948
949               list primitive {
950                  key "index";
951
952                  leaf index {
953                    description "Index of this primitive";
954                    type uint32;
955                  }
956
957                  leaf name {
958                    description "Name of the primitive in the VNF primitive ";
959                    type string;
960                  }
961               }
962            }
963
964            leaf user-defined-script {
965              description
966                "A user defined script.";
967              type string;
968            }
969         }
970
971         list initial-service-primitive {
972           description
973             "Initial set of service primitives for NSD.";
974           key "seq";
975
976           uses event-service-primitive;
977         }
978
979         list terminate-service-primitive {
980           description
981             "Set of service primitives to
982              execute during termination of NSD.";
983           key "seq";
984
985           uses event-service-primitive;
986         }
987
988         list monitoring-param {
989           description
990             "List of NS level params.";
991           key "id";
992
993           uses manotypes:monitoring-param-value;
994           uses manotypes:monitoring-param-ui-data;
995           uses manotypes:monitoring-param-aggregation;
996
997           leaf id {
998             type string;
999           }
1000
1001           leaf name {
1002             type string;
1003           }
1004
1005           leaf nsd-mon-param-ref {
1006             description "Reference to the NSD monitoring param descriptor
1007                        that produced this result";
1008             // TODO: Fix leafref
1009             type leafref {
1010               path "../../../../project-nsd:nsd-catalog/project-nsd:nsd" +
1011                 "[project-nsd:id = current()/../../nsd-ref]" +
1012                 "/project-nsd:monitoring-param/project-nsd:id";
1013             }
1014           }
1015
1016           list vnfr-mon-param-ref {
1017             description "A list of VNFR monitoring params associated with this monp";
1018             key "vnfr-id-ref vnfr-mon-param-ref";
1019
1020             leaf vnfr-id-ref {
1021               description
1022                 "A reference to a vnfr. This is a
1023                 leafref to path:
1024                     /vnfr:vnfr-catalog/vnfr:vnfr/vnfr:id";
1025
1026               type yang:uuid;
1027             }
1028
1029             leaf vnfr-mon-param-ref {
1030               description "A reference to the VNFR monitoring param";
1031               type leafref {
1032                 path "../../../../../vnfr:vnfr-catalog/vnfr:vnfr"
1033                   + "[vnfr:id = current()/../vnfr-id-ref]"
1034                   + "/vnfr:monitoring-param/vnfr:id";
1035               }
1036             }
1037           }
1038         }
1039
1040         list config-agent-job {
1041           key "job-id";
1042
1043           leaf job-id {
1044             description "config agent job Identifier for the NS.";
1045             type uint64;
1046           }
1047
1048           leaf job-name {
1049             description "Config agent job name";
1050             type string;
1051           }
1052
1053           leaf job-status {
1054             description
1055               "Job status to be set based on each VNF primitive execution,
1056                pending  - if at least one VNF is in pending state
1057                           and remaining VNFs are in success state.
1058                Success  - if all VNF executions are in success state
1059                failure  - if one of the VNF executions is failure";
1060             type enumeration {
1061               enum pending;
1062               enum success;
1063               enum failure;
1064             }
1065           }
1066
1067           leaf triggered-by {
1068             description "The primitive is triggered from NS or VNF level";
1069             type trigger-type;
1070           }
1071
1072           leaf create-time {
1073             description
1074               "Creation timestamp of this Config Agent Job.
1075             The timestamp is expressed as seconds
1076             since unix epoch - 1970-01-01T00:00:00Z";
1077
1078             type uint32;
1079           }
1080
1081           leaf job-status-details {
1082             description "Config agent job status details, in case of errors";
1083             type string;
1084           }
1085
1086           uses manotypes:primitive-parameter-value;
1087
1088           list parameter-group {
1089             description
1090               "List of NS Primitive parameter groups";
1091             key "name";
1092             leaf name {
1093               description
1094                 "Name of the parameter.";
1095               type string;
1096             }
1097
1098             uses manotypes:primitive-parameter-value;
1099           }
1100
1101           list vnfr {
1102             key "id";
1103             leaf id {
1104               description "Identifier for the VNFR.";
1105               type yang:uuid;
1106             }
1107             leaf vnf-job-status {
1108               description
1109                 "Job status to be set based on each VNF primitive execution,
1110                  pending  - if at least one primitive is in pending state
1111                             and remaining primitives are in success state.
1112                  Success  - if all primitive executions are in success state
1113                  failure  - if one of the primitive executions is failure";
1114               type enumeration {
1115                 enum pending;
1116                 enum success;
1117                 enum failure;
1118               }
1119             }
1120
1121             list primitive {
1122               key "name";
1123               leaf name {
1124                 description "the name of the primitive";
1125                 type string;
1126               }
1127
1128               uses manotypes:primitive-parameter-value;
1129
1130               leaf execution-id {
1131                 description "Execution id of the primitive";
1132                 type string;
1133               }
1134               leaf execution-status {
1135                 description "status of the Execution";
1136                 type enumeration {
1137                   enum pending;
1138                   enum success;
1139                   enum failure;
1140                 }
1141               }
1142               leaf execution-error-details {
1143                 description "Error details if execution-status is failure";
1144                 type string;
1145               }
1146             }
1147           }
1148         }
1149       }
1150     }
1151   }
1152
1153   grouping rpc-common {
1154     uses manotypes:rpc-project-name;
1155
1156     leaf nsr_id_ref {
1157       description "Reference to NSR ID ref";
1158       type leafref {
1159         path "/rw-project:project[rw-project:name=current()/.." +
1160           "/nsr:project-name]/nsr:ns-instance-config/nsr:nsr/nsr:id";
1161       }
1162       mandatory true;
1163     }
1164   }
1165
1166   rpc get-ns-service-primitive-values {
1167     description "Get the service primitive parameter values";
1168
1169     input {
1170       leaf name {
1171         description "Name of the NS service primitive group";
1172         mandatory true;
1173         type string;
1174       }
1175
1176       uses rpc-common;
1177     }
1178
1179     output {
1180       list ns-parameter {
1181         description "Automatically generated parameter";
1182         key "name";
1183
1184         leaf name {
1185           description "Parameter name which should be pulled from a parameter pool";
1186           type string;
1187         }
1188         leaf value {
1189           description "Automatically generated value";
1190           type string;
1191         }
1192       }
1193
1194       list ns-parameter-group {
1195         description "Automatically generated parameters in parameter group";
1196         key "name";
1197         leaf name {
1198           description "Parameter group name";
1199           type string;
1200         }
1201         list parameter {
1202           description "Automatically generated group parameter";
1203           key "name";
1204
1205           leaf name {
1206             description "Parameter name which should be pulled from a parameter pool";
1207             type string;
1208           }
1209           leaf value {
1210             description "Automatically generated value";
1211             type string;
1212           }
1213         }
1214       }
1215
1216       list vnf-primitive-group {
1217         description
1218             "List of service primitives grouped by VNF.";
1219
1220         key "member-vnf-index-ref";
1221         leaf member-vnf-index-ref {
1222           description
1223               "Reference to member-vnf within constituent-vnfds";
1224           type string;
1225         }
1226
1227         leaf vnfd-id-ref {
1228           description
1229               "A reference to a vnfd. This is a
1230                leafref to path:
1231                    ../../../../project-nsd:constituent-vnfd
1232                    + [project-nsd:id = current()/../project-nsd:id-ref]
1233                    + /project-nsd:vnfd-id-ref
1234                NOTE: An issue with confd is preventing the
1235                use of xpath. Seems to be an issue with leafref
1236                to leafref, whose target is in a different module.
1237                Once that is resolved this will switched to use
1238                leafref";
1239
1240           type string;
1241         }
1242
1243         list primitive {
1244           key "index";
1245           leaf index {
1246             description "Index of this primitive";
1247             type uint32;
1248           }
1249
1250           leaf name {
1251             description "Name of the primitive associated with a value pool";
1252             type string;
1253           }
1254
1255           list parameter {
1256             description "Automatically generated parameter";
1257             key "name";
1258
1259             leaf name {
1260               description "Parameter name which should be pulled from a parameter pool";
1261               type string;
1262             }
1263             leaf value {
1264               description "Automatically generated value";
1265               type string;
1266             }
1267           }
1268         }
1269       }
1270     }
1271   }
1272
1273   rpc exec-ns-service-primitive {
1274     description "Executes a NS service primitive or script";
1275
1276     input {
1277       leaf name {
1278         description "Name of the primitive";
1279         type string;
1280       }
1281
1282       uses rpc-common;
1283
1284       leaf triggered-by {
1285         description "The primitive is triggered from NS or VNF level";
1286         type trigger-type;
1287         default ns-primitive;
1288       }
1289
1290       uses manotypes:primitive-parameter-value;
1291
1292       list parameter-group {
1293         description
1294             "List of NS Primitive parameter groups";
1295         key "name";
1296         leaf name {
1297           description
1298               "Name of the parameter.";
1299           type string;
1300         }
1301
1302         uses manotypes:primitive-parameter-value;
1303       }
1304
1305       list vnf-list {
1306         description
1307             "List of VNFs whose primitives are being set.";
1308         key "member_vnf_index_ref";
1309
1310         leaf member_vnf_index_ref {
1311           description "Member VNF index";
1312           type uint64;
1313         }
1314
1315         leaf vnfr-id-ref {
1316           description
1317               "A reference to a vnfr. This is a
1318                leafref to path";
1319           type yang:uuid;
1320         }
1321
1322         list vnf-primitive {
1323           description
1324               "List of service primitives supported by the
1325             configuration agent for this VNF.";
1326           key "index";
1327
1328           leaf index {
1329             description
1330                 "index of the service primitive.";
1331             type uint32;
1332           }
1333           leaf name {
1334             description
1335                 "Name of the service primitive.";
1336             type string;
1337           }
1338
1339           uses manotypes:primitive-parameter-value;
1340         }
1341       }
1342       leaf user-defined-script {
1343         description
1344             "A user defined script.";
1345         type string;
1346       }
1347     }
1348     output {
1349       leaf job-id {
1350         description "Job identifier for this RPC";
1351         type uint64;
1352       }
1353
1354       leaf name {
1355         description "Name of the service primitive";
1356         type string;
1357       }
1358
1359       uses rpc-common;
1360
1361       leaf triggered-by {
1362         description "The primitive is triggered from NS or VNF level";
1363         type trigger-type;
1364       }
1365
1366       leaf create-time {
1367         description
1368           "Creation timestamp of this config agent JOB.
1369           The timestamp is expressed as seconds
1370           since unix epoch - 1970-01-01T00:00:00Z";
1371
1372         type uint32;
1373       }
1374
1375       leaf job-status-details {
1376         description "Job status details, in case of any errors";
1377         type string;
1378       }
1379
1380       uses manotypes:primitive-parameter-value;
1381
1382       list parameter-group {
1383         description
1384             "List of NS Primitive parameter groups";
1385         key "name";
1386         leaf name {
1387           description
1388               "Name of the parameter.";
1389           type string;
1390         }
1391
1392         uses manotypes:primitive-parameter-value;
1393       }
1394
1395       list vnf-out-list {
1396         description
1397             "List of VNFs whose primitives were set.";
1398         key "member_vnf_index_ref";
1399
1400         leaf member_vnf_index_ref {
1401           description "Member VNF index";
1402           type uint64;
1403         }
1404         leaf vnfr-id-ref {
1405           description
1406               "A reference to a vnfr. This is a
1407                leafref to path";
1408           type yang:uuid;
1409         }
1410
1411         list vnf-out-primitive {
1412           description
1413               "List of service primitives supported by the
1414             configuration agent for this VNF.";
1415           key "index";
1416
1417           leaf index {
1418             description
1419                 "index of the service primitive.";
1420             type uint32;
1421           }
1422
1423           leaf name {
1424             description
1425                 "Name of the service primitive.";
1426             type string;
1427           }
1428
1429           uses manotypes:primitive-parameter-value;
1430
1431           leaf execution-id {
1432             description "Execution id of this primitive";
1433             type string;
1434           }
1435
1436           leaf execution-status {
1437             description "Status of the execution of this primitive";
1438             type string;
1439           }
1440
1441           leaf execution-error-details {
1442             description "Error details if execution-status is failed";
1443             type string;
1444           }
1445         }
1446       }
1447     }
1448   }
1449
1450   rpc exec-scale-in {
1451     description "Executes scale out request";
1452
1453     input {
1454       uses rpc-common;
1455
1456       leaf scaling-group-name-ref {
1457         description "name of the scaling group";
1458         type leafref {
1459           path "/rw-project:project[rw-project:name=current()/.." +
1460             "/nsr:project-name]/nsr:ns-instance-config/nsr:nsr" +
1461             "[nsr:id=current()/../nsr:nsr_id_ref]/nsr:nsd" +
1462             "/nsr:scaling-group-descriptor/nsr:name";
1463         }
1464         mandatory true;
1465       }
1466
1467       leaf instance-id {
1468         description "id of the scaling group";
1469         type leafref {
1470           path "/rw-project:project[rw-project:name=current()/.." +
1471             "/nsr:project-name]/nsr:ns-instance-config/nsr:nsr" +
1472             "[nsr:id=current()/../nsr:nsr_id_ref]" +
1473             "/nsr:scaling-group[nsr:scaling-group-name-ref=current()/.." +
1474             "/nsr:scaling-group-name-ref]/nsr:instance/nsr:id";
1475         }
1476         mandatory true;
1477       }
1478
1479
1480     }
1481     output {
1482       leaf instance-id {
1483         description "id of the scaling group";
1484         type uint64;
1485       }
1486     }
1487   }
1488
1489   rpc exec-scale-out {
1490     description "Executes scale out request";
1491
1492     input {
1493       uses rpc-common;
1494
1495       leaf scaling-group-name-ref {
1496         description "name of the scaling group";
1497         type leafref {
1498           path "/rw-project:project[rw-project:name=current()/.." +
1499             "/nsr:project-name]/nsr:ns-instance-config/nsr:nsr" +
1500             "[nsr:id=current()/../nsr:nsr_id_ref]/nsr:nsd" +
1501             "/nsr:scaling-group-descriptor/nsr:name";
1502         }
1503         mandatory true;
1504       }
1505
1506       leaf instance-id {
1507         description "id of the scaling group";
1508         type uint64;
1509       }
1510     }
1511
1512     output {
1513      leaf instance-id {
1514         description "id of the scaling group";
1515         type uint64;
1516       }
1517     }
1518   }
1519
1520   rpc start-network-service {
1521     description "Start the network service";
1522     input {
1523       leaf name {
1524         mandatory true;
1525         description "Name of the Network Service";
1526         type string;
1527       }
1528
1529       uses manotypes:rpc-project-name;
1530
1531       leaf nsd_id_ref {
1532         description "Reference to NSD ID ref";
1533         type leafref {
1534           path "/rw-project:project[rw-project:name=current()/.." +
1535             "/project-name]/project-nsd:nsd-catalog/project-nsd:nsd/project-nsd:id";
1536         }
1537       }
1538       uses ns-instance-config-params-common;
1539
1540       list vnfd-placement-group-maps {
1541         description
1542           "Mapping from mano-placement groups construct from VNFD to cloud
1543           platform placement group construct";
1544
1545         key "placement-group-ref vnfd-id-ref";
1546
1547         leaf vnfd-id-ref {
1548           description
1549             "A reference to a vnfd. This is a
1550           leafref to path:
1551           ../../../../project-nsd:constituent-vnfd
1552           + [id = current()/../project-nsd:id-ref]
1553           + /project-nsd:vnfd-id-ref
1554           NOTE: An issue with confd is preventing the
1555           use of xpath. Seems to be an issue with leafref
1556           to leafref, whose target is in a different module.
1557           Once that is resovled this will switched to use
1558           leafref";
1559           type yang:uuid;
1560         }
1561
1562         leaf placement-group-ref {
1563           description
1564             "A reference to VNFD placement group";
1565           type leafref {
1566             path "/rw-project:project[rw-project:name=current()/" +
1567               "../../project-name]/project-vnfd:vnfd-catalog/project-vnfd:vnfd[project-vnfd:id = " +
1568               "current()/../vnfd-id-ref]/project-vnfd:placement-groups/project-vnfd:name";
1569           }
1570         }
1571
1572         uses manotypes:placement-group-input;
1573
1574         list ssh-authorized-key {
1575           key "key-pair-ref";
1576
1577           description "List of authorized ssh keys as part of cloud-config";
1578
1579           leaf key-pair-ref {
1580             description "A reference to the key pair entry in the global key pair table";
1581             type leafref {
1582               path "/rw-project:project[rw-project:name=current()/../../../" +
1583                 "project-name]/key-pair/name";
1584             }
1585           }
1586         }
1587
1588         list user {
1589           key "name";
1590
1591           description "List of users to be added through cloud-config";
1592           leaf name {
1593             description "Name of the user ";
1594             type string;
1595           }
1596           leaf user-info {
1597             description "The user name's real name";
1598             type string;
1599           }
1600           list ssh-authorized-key {
1601             key "key-pair-ref";
1602
1603             description "Used to configure the list of public keys to be injected as part
1604                         of ns instantiation";
1605
1606             leaf key-pair-ref {
1607               description "A reference to the key pair entry in the global key pair table";
1608               type leafref {
1609                 path "/rw-project:project[rw-project:name=current()/" +
1610                   "../../../../project-name]/key-pair/name";
1611               }
1612             }
1613           }
1614         }
1615       }
1616     }
1617
1618     output {
1619       leaf nsr-id {
1620         description "Automatically generated parameter";
1621         type yang:uuid;
1622       }
1623     }
1624   }
1625 }