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