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