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