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