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