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