Merge of new rebased code
[appc.git] / appc-provider / appc-provider-model / src / main / yang / appc-provider-lcm.yang
1 /*
2  * Yang model for the Application Controller (APP-C) component of ECOMP
3  *
4  * This model is used to define the data and services of the Application Controller
5  * component of ECOMP.  The APP-C controller initiates the processing of directed
6  * graphs, which define the actual process implementations used.  The name of the
7  * directed graph is set by properties and cannot be changed dynamically.
8  *
9  * The services exposed by this provider are:
10  *
11  * restart-vnf:
12  *    Used to request a restart of a virtual network function (a VM).
13  *
14  * rebuild-vnf:
15  *    Used to request a rebuild of a virtual network function (a VM).
16  *
17  */
18
19 module appc-provider-lcm {
20
21     yang-version 1;
22     namespace "org:openecomp:appc:lcm";
23     prefix appc-provider-lcm;
24     organization "Copyright 2017 AT&T Intellectual Property.";
25
26     description
27       "Defines the services and request/response requirements for the ECOMP APP-C component.";
28
29     /*
30      * Note, the revision changes the package name of the generated java code.  Do not
31      * change the revision unless you also update all references to the bindings.
32      */
33     revision "2016-01-08" {
34       description
35         "APP-C interface version 1.0.48";
36     }
37
38     /**********************************************************************************
39      * Data type definitions
40      *
41      * The following data type definitions are used to define common data structures,
42      * define constraints, or to impart special meanings to data objects related to the
43      * APP-C controller functions.
44      **********************************************************************************/
45
46    
47
48     typedef ZULU {
49         description "Define a common definition of a time stamp (expressed as a formatted
50                 string) as follows yyyy-MM-ddTHH:mm:ss.SSSSSSSSZ";
51         type string {
52             length "16..28";
53             pattern "[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]{1,6}Z";
54         }
55     }
56
57     typedef payload {
58            type string ;
59            description "The payload can be any valid JSON string value. Json escape characters need to be added when required to include an inner json within the payload to make it a valid json string value";
60     }
61
62     typedef action {
63         type enumeration {
64             enum "Restart";
65             enum "Rebuild";
66             enum "Migrate";
67             enum "Evacuate";
68             enum "Snapshot";
69             enum "Rollback";
70             enum "Sync";
71             enum "Audit";
72             enum "Stop";
73             enum "Start";
74             enum "Terminate";
75             enum "SoftwareUpload";
76             enum "HealthCheck";
77             enum "LiveUpgrade";
78             enum "Lock";
79             enum "Unlock";
80             enum "Test";
81             enum "CheckLock";
82             enum "Configure";
83             enum "ConfigModify";
84             enum "ConfigScaleOut";
85             enum "ConfigRestore";
86             enum "ConfigBackup";
87             enum "ConfigBackupDelete";
88             enum "ConfigExport";
89         }
90         description "The action to be taken by APP-C, e.g. Restart, Rebuild, Migrate";
91     }
92
93     /**********************************************************************************
94      * All requests will include this standard header
95      *
96      * The standard request header is used to define a correlation identification for
97      * the request that is returned on all responses.  This correlation identifier
98      * (called the service-request-id) is meaningful to the caller and is included on
99      * all responses from the services.
100      **********************************************************************************/
101     
102
103     /**********************************************************************************
104      * Basic manipulation of a VNF (or VM) will typically include querying the current
105      * state, restarting, rebuilding, stopping, starting, etc.  In all of these basic
106      * "state"-type operations, the services require the identification of the VNF to
107      * be operated on, and the region or LCP that contains that resource.  This
108      * information is used across all of these services, so it has been defined as a
109      * common structure here and is referenced in the appropriate RPC definitions.
110      **********************************************************************************/
111     
112
113     /**********************************************************************************
114      * All responses will include this standard header
115      *
116      * The standard response header includes the time of completion as well as a
117      * success|failure indication
118      **********************************************************************************/
119     
120
121
122        /**********************************************************************************
123          * All requests/response will include this standard header
124          *
125          * The standard common header is used to define a correlation identification for
126          * the request that is returned on all responses.
127          **********************************************************************************/
128     
129     
130     
131     grouping common-header {
132         description "A common header for all APP-C requests";
133         container common-header {
134             description "A common header for all APP-C requests";
135             leaf timestamp {
136                 description "timestamp is in ISO 8601 timestamp format ZULU offset";
137                 type ZULU;
138                 mandatory true;
139             }
140
141             leaf api-ver {
142                 description "api-ver is the API version identifier. A given release of APPC
143                                 should support all previous versions of APPC API (correlate with
144                                 general requirements)";
145                 type string {
146                     pattern "[2]\.\d\d" {
147                         error-message "API Version 2.XX is supported at this end point";
148                     }
149                 }
150                 mandatory true;
151             }
152
153             leaf originator-id {
154                 description "originator-id an identifier of the calling system which can be
155                                 used addressing purposes, i.e. returning asynchronous response
156                                 to the proper destination over DMaaP (especially in case of multiple
157                                 consumers of APP-C APIs)";
158                 type string;
159                 mandatory true;
160             }
161
162             leaf request-id {
163                 description "UUID for the request ID. An OSS/BSS identifier for the request
164                                 that caused the current action. Multiple API calls may be made
165                                 with the same request-id The request-id shall be recorded throughout
166                                 the operations on a single request";
167                 type string;
168                 mandatory true;
169             }
170
171             leaf sub-request-id {
172                 description "Uniquely identifies a specific LCM action. It is persistent over
173                                 the life-cycle of a single request";
174                 type string;
175                 mandatory false;
176             }
177
178
179                 /**********************************************************************************
180                  * Flags are generic flags that apply to any and all commands, all are optional
181                  *  force = TRUE/FALSE - Execute command even if target is in unstable (i.e. locked, transiting, etc) state. Specific behaviour of forced commands varies, but implies cancellation of previous command and an override by the new command. The FALSE value is used by default.
182                  *  ttl = <0....N> - The timeout value for command execution, expressed in seconds
183                  *  mode = EXCLUSIVE/NORMAL - defines execution mode as follows:
184                  *        - EXCLUSIVE ? on encountering an exclusive command, the APP-C will:
185                  *          * Cease accepting additional command requests
186                  *          * Complete execution of outstanding commands
187                  *          * Execute the exclusive command to completion
188                  *          * Optionally report the result of the command
189                  *          * Optionally resume command acceptance and processing
190                  *        - NORMAL - Obverse of EXCLUSIVE, the default one.
191                  **********************************************************************************/
192             container flags {
193                 description "Flags are generic flags that apply to any and all commands, all
194                                 are optional";
195                 leaf mode {
196                     type enumeration {
197                         enum "EXCLUSIVE";
198                         enum "NORMAL";
199                     }
200                     description "EXCLUSIVE (accept no queued requests on this VNF while processing)
201                                         or NORMAL (queue other requests until complete)";
202                     mandatory false;
203                 }
204                 leaf force {
205                     type enumeration {
206                         enum "TRUE";
207                         enum "FALSE";
208                     }
209                     description "TRUE/FALSE - Execute action even if target is in unstable (i.e.
210                                         locked, transiting, etc.) state";
211                     mandatory false;
212                 }
213                 leaf ttl {
214                     description "<0....N> - The timeout value (expressed in seconds) for action
215                                         execution, between action being received by APPC and action initiation";
216                     type uint16;
217                     mandatory false;
218                 }
219                 }
220             }
221         }
222
223
224     grouping action-identifiers {
225         description "A block containing the action arguments. These are used to specify
226                 the object upon which APP-C LCM command is to operate";
227         container action-identifiers {
228             description "A block containing the action arguments. These are used to specify
229                         the object upon which APP-C LCM command is to operate";
230             leaf service-instance-id {
231                 description "identifies a specific service the command refers to. When multiple
232                                 APP-C instances are used and applied to a subset of services,
233                                 this will become significant . The field is mandatory when the
234                                 vnf-id is empty";
235                 type string;
236                 mandatory false;
237             }
238             leaf vnf-id {
239                 description "identifies the VNF to which this action is to be applied(vnf-id
240                                 uniquely identifies the service-instance referred to). Note that
241                                 some actions are applied to multiple VNFs in the same service.
242                                 When this is the case, vnf-id may be left out, but service-instance-id
243                                 must appear. The field is mandatory when service-instance-id is
244                                 empty";
245                 type string;
246                 mandatory false;
247             }
248             leaf vnfc-name {
249                 description "identifies the VNFC to which this action is to be applied. Some
250                                 actions apply only to a component within a VNF (e.g. RESTART is
251                                 sometimes applied to on VM only). In such a case, the name of
252                                 the VNFC is used to search for the component within the VNF";
253                 type string;
254                 mandatory false;
255             }
256             leaf vserver-id {
257                 description "identifies a specific VM within the given service/vnf to which
258                                 this action is to be applied";
259                 type string;
260                 mandatory false;
261             }
262         }
263     }
264
265
266      grouping status {
267             description "The specific response codes are to be aligned with ASDC reference doc (main table removed to avoid duplication and digression from main table). See ASDC and ECOMP Distribution Consumer Interface Agreement";
268             container status {
269                 description "The specific response codes are to be aligned with ASDC reference doc (main table removed to avoid duplication and digression from main table). See ASDC and ECOMP Distribution Consumer Interface Agreement";
270                 leaf code {
271                     description "Response code";
272                     type uint16;
273                     mandatory true;
274                 }
275                 leaf message {
276                     description "Response message";
277                     type string;
278                     mandatory true;
279                 }
280             }
281       }
282
283
284
285
286
287     /**********************************************************************************
288              * Define the restart service
289              **********************************************************************************/
290             rpc restart {
291                 description "An operation to restart a virtual network function (or VM)";
292                  input {
293                     uses common-header;
294                     leaf action {
295                         type action;
296                         mandatory true;
297                     }
298                     uses action-identifiers;
299                     leaf payload {
300                       type payload;
301                       mandatory false;
302                     }
303                 }
304                 output {
305                     uses common-header;
306                     uses status;
307                 }
308             }
309
310             /**********************************************************************************
311              * Define the rebuild service
312              **********************************************************************************/
313             rpc rebuild {
314                 description "An operation to rebuild a virtual network function (or VM)";
315                 input {
316                     uses common-header;
317                     leaf action {
318                         type action;
319                         mandatory true;
320                     }
321                     uses action-identifiers;
322                     leaf payload {
323                         type payload;
324                         mandatory false;
325                     }
326                 }
327                 output {
328                     uses common-header;
329                     uses status;
330                 }
331             }
332
333             /**********************************************************************************
334              * Define the migrate service
335              **********************************************************************************/
336             rpc migrate {
337                 description "An operation to migrate a virtual network function (or VM)";
338                 input {
339                     uses common-header;
340                     leaf action {
341                         type action;
342                         mandatory true;
343                     }
344                     uses action-identifiers;
345                     leaf payload {
346                         type payload;
347                         mandatory false;
348                     }
349                 }
350                 output {
351                     uses common-header;
352                     uses status;
353                 }
354             }
355
356              /**********************************************************************************
357              * Define the evacuate service
358              **********************************************************************************/
359             rpc evacuate {
360                 description "An operation to evacuate a virtual network function (or VM)";
361                 input {
362                     uses common-header;
363                     leaf action {
364                         type action;
365                         mandatory true;
366                     }
367                     uses action-identifiers;
368                     leaf payload {
369                         type payload;
370                         mandatory false;
371                     }
372                 }
373                 output {
374                     uses common-header;
375                     uses status;
376                 }
377             }
378
379
380          /**********************************************************************************
381          * Define the snapshot service
382          **********************************************************************************/
383         rpc snapshot {
384             description "An operation to create a snapshot of a virtual network function (or VM)";
385             input {
386                 uses common-header;
387                 leaf action {
388                   type action;
389                   mandatory true;
390                 }
391                 uses action-identifiers;
392                 leaf payload {
393                   type payload;
394                   mandatory false;
395                 }
396                 leaf identity-url {
397                     type string;
398                      mandatory true;
399                 }
400             }
401             output {
402                 uses common-header;
403                 uses status;
404                 leaf snapshot-id {
405                     type string;
406                 }
407
408             }
409         }
410
411          /**********************************************************************************
412          * Define the rollback service
413          **********************************************************************************/
414         rpc rollback {
415             description "An operation to rollback to particular snapshot of a virtual network function (or VM)";
416             input {
417                 uses common-header;
418                 leaf action {
419                   type action;
420                   mandatory true;
421                 }
422                 uses action-identifiers;
423                 leaf payload {
424                   type payload;
425                   mandatory false;
426                 }
427                 leaf identity-url {
428                     type string;
429                      mandatory true;
430                 }
431                 leaf snapshot-id {
432                     type string;
433                      mandatory true;
434                 }
435             }
436             output {
437                 uses common-header;
438                 uses status;
439             }
440         }
441
442
443     /**********************************************************************************
444      * Additional RPCs added here...
445      **********************************************************************************/
446
447
448       /**********************************************************************************
449      * Define the sync service
450      **********************************************************************************/
451     rpc sync {
452         description "An operation to sync the configurations of a virtual network function (or VM)";
453         input {
454             uses common-header;
455             leaf action {
456                        type action;
457                        mandatory true;
458             }
459             uses action-identifiers;
460             leaf payload {
461                 type payload;
462                 mandatory false;
463             }
464         }
465         output {
466             uses common-header;
467             uses status;
468             leaf payload {
469                 type payload;
470                 mandatory false;
471            }
472         }
473     }
474
475     /**********************************************************************************
476      * Define the terminate service
477      **********************************************************************************/
478     rpc terminate {
479         description "An operation to terminate the configurations of a virtual network function (or VM)";
480         input {
481             uses common-header;
482             leaf action {
483                        type action;
484                        mandatory true;
485             }
486             uses action-identifiers;
487             leaf payload {
488                         type payload;
489                         mandatory false;
490             }
491         }
492         output {
493             uses common-header;
494             uses status;
495         }
496     }
497
498
499     rpc configure {
500         description "An operation to configure the configurations of a virtual network
501                 function (or VM)";
502         input {
503             uses common-header;
504             leaf action {
505                 type action;
506                 mandatory true;
507             }
508             uses action-identifiers;
509             leaf payload {
510                 type payload;
511                 mandatory false;
512             }
513         }
514         output {
515             uses common-header;
516             uses status;
517             leaf payload {
518                  type payload;
519                  mandatory false;
520             }
521         }
522     }
523
524     rpc config-modify {
525         description "Use the ModifyConfig command when a full configuration cycle is either not required or is considered too costly. The ModifyConfig LCM action affects only a subset of the total configuration data of a VNF. The set of configuration parameters to be affected is a subset of the total configuration data of the target VNF type. The payload block must contain the configuration parameters to be modified and their values. A successful modify returns a success response. A failed modify returns a failure response and the specific failure messages in the response payload block";
526         input {
527             uses common-header;
528             leaf action {
529                 type action;
530                 mandatory true;
531             }
532             uses action-identifiers;
533             leaf payload {
534                 type payload;
535                 mandatory false;
536             }
537         }
538         output {
539             uses common-header;
540             uses status;
541             leaf payload {
542                  type payload;
543                  mandatory false;
544             }
545         }
546     }
547
548     rpc config-scaleout {
549         description "An operation to scaleout the configurations of a virtual network
550                 function (or VM)";
551         input {
552             uses common-header;
553             leaf action {
554                 type action;
555                 mandatory true;
556             }
557             uses action-identifiers;
558             leaf payload {
559                 type payload;
560                 mandatory false;
561             }
562         }
563         output {
564             uses common-header;
565             uses status;
566             leaf payload {
567                  type payload;
568                  mandatory false;
569             }
570         }
571     }
572
573     rpc config-restore {
574         description "An operation to restore the configurations of a virtual network
575                 function (or VM)";
576         input {
577             uses common-header;
578             leaf action {
579                 type action;
580                 mandatory true;
581             }
582             uses action-identifiers;
583             leaf payload {
584                 type payload;
585                 mandatory false;
586             }
587         }
588         output {
589             uses common-header;
590             uses status;
591             leaf payload {
592                  type payload;
593                  mandatory false;
594             }
595         }
596     }
597
598     /**********************************************************************************
599          * Define the test service
600          **********************************************************************************/
601     rpc test {
602         description "An operation to test the configurations of a virtual network function (or VM)";
603         input {
604             uses common-header;
605             leaf action {
606                        type action;
607                        mandatory true;
608             }
609             uses action-identifiers;
610             leaf payload {
611                         type payload;
612                         mandatory false;
613             }
614         }
615         output {
616             uses common-header;
617             uses status;
618         }
619     }
620
621         /**********************************************************************************
622          * Define the stop service
623          **********************************************************************************/
624         rpc stop {
625             description "An operation to stop the configurations of a virtual network function (or VM)";
626             input {
627                 uses common-header;
628                 leaf action {
629                            type action;
630                            mandatory true;
631                 }
632                 uses action-identifiers;
633                 leaf payload {
634                             type payload;
635                             mandatory false;
636                 }
637             }
638             output {
639                 uses common-header;
640                 uses status;
641             }
642         }
643
644         rpc start {
645             description "An operation to start a virtual network function (or VM)";
646             input {
647                 uses common-header;
648                 leaf action {
649                     type action;
650                     mandatory true;
651                 }
652                 uses action-identifiers;
653                 leaf payload {
654                     type payload;
655                     mandatory false;
656                 }
657             }
658             output {
659                 uses common-header;
660                 uses status;
661             }
662         }
663
664        /**********************************************************************************
665         * Define the audit service
666         **********************************************************************************/
667        rpc audit {
668            description "An operation to audit the configurations of a virtual network function (or VM)";
669            input {
670                uses common-header;
671                leaf action {
672                           type action;
673                           mandatory true;
674                }
675                uses action-identifiers;
676                leaf payload {
677                    type payload;
678                    mandatory false;
679                }
680            }
681            output {
682                uses common-header;
683                uses status;
684                leaf payload {
685                    type payload;
686                    mandatory false;
687               }
688            }
689        }
690
691        /**********************************************************************************
692        * Define the SoftwareUpload vSCP service
693        **********************************************************************************/
694       rpc software-upload {
695           description "An operation to upload a new version of vSCP image to vSCP for updating it";
696           input {
697               uses common-header;
698               leaf action {
699                          type action;
700                          mandatory true;
701               }
702               uses action-identifiers;
703               leaf payload {
704                           type payload;
705                           mandatory false;
706               }
707           }
708           output {
709               uses common-header;
710               uses status;
711           }
712       }
713
714
715
716       /**********************************************************************************
717            * Define the PreHealthCheck vSCP service
718            **********************************************************************************/
719           rpc health-check {
720               description "An operation to perform health check of vSCP prior its upgrading";
721               input {
722                   uses common-header;
723                   leaf action {
724                              type action;
725                              mandatory true;
726                   }
727                   uses action-identifiers;
728                   leaf payload {
729                                                    type payload;
730                                                    mandatory false;
731                                        }
732               }
733               output {
734                   uses common-header;
735                   uses status;
736
737               }
738           }
739
740
741     /**********************************************************************************
742               * Define the Upgrade vSCP service
743               **********************************************************************************/
744              rpc live-upgrade {
745                  description "An operation to perform upgrade of vSCP";
746                  input {
747                      uses common-header;
748                      leaf action {
749                                 type action;
750                                 mandatory true;
751                      }
752                      uses action-identifiers;
753                      leaf payload {
754                                  type payload;
755                                  mandatory false;
756                      }
757                  }
758                  output {
759                      uses common-header;
760                      uses status;
761                  }
762              }
763
764
765      /**********************************************************************************
766                      * Define the VNF lock service
767                      **********************************************************************************/
768                     rpc lock {
769                         description "An operation to perform VNF lock operation";
770                         input {
771                             uses common-header;
772                             leaf action {
773                                        type action;
774                                        mandatory true;
775                             }
776                             uses action-identifiers;
777                             leaf payload {
778                                         type payload;
779                                         mandatory false;
780                             }
781                         }
782                         output {
783                             uses common-header;
784                             uses status;
785                         }
786                     }
787
788         /**********************************************************************************
789          * Define the VNF unlock service
790          **********************************************************************************/
791                         rpc unlock {
792                             description "An operation to perform VNF unlock operation";
793                             input {
794                                 uses common-header;
795                                 leaf action {
796                                            type action;
797                                            mandatory true;
798                                 }
799                                 uses action-identifiers;
800                                 leaf payload {
801                                             type payload;
802                                             mandatory false;
803                                 }
804                             }
805                             output {
806                                 uses common-header;
807                                 uses status;
808                             }
809                         }
810
811      /**********************************************************************************
812      * Define the VNF check lock service
813      **********************************************************************************/
814     rpc check-lock {
815         description "An operation to check VNF lock status";
816         input {
817             uses common-header;
818             leaf action {
819                        type action;
820                        mandatory true;
821             }
822             uses action-identifiers;
823         }
824         output {
825             uses common-header;
826             uses status;
827             leaf locked {
828                 type enumeration {
829                             enum "TRUE";
830                             enum "FALSE";
831                        }
832                 description "TRUE/FALSE - returns TRUE when the given VNF was locked, otherwise returns FALSE";
833                 mandatory false;
834             }
835         }
836     }
837
838
839     rpc config-backup {
840         description "An operation to Backup configurations of a virtual network function
841                 (or VM)";
842         input {
843             uses common-header;
844             leaf action {
845                 type action;
846                 mandatory true;
847             }
848             uses action-identifiers;
849         }
850         output {
851             uses common-header;
852             uses status;
853             leaf payload {
854                  type payload;
855                  mandatory false;
856             }
857         }
858     }
859
860     rpc config-backup-delete {
861         description "An operation to Delete backup configurations of a virtual network
862                 function (or VM)";
863         input {
864             uses common-header;
865             leaf action {
866                 type action;
867                 mandatory true;
868             }
869             uses action-identifiers;
870         }
871         output {
872             uses common-header;
873             uses status;
874             leaf payload {
875                  type payload;
876                  mandatory false;
877             }
878         }
879     }
880
881     rpc config-export {
882         description "An operation to Export configurations of a virtual network function
883                 (or VM)";
884         input {
885             uses common-header;
886             leaf action {
887                 type action;
888                 mandatory true;
889             }
890             uses action-identifiers;
891         }
892         output {
893             uses common-header;
894             uses status;
895         }
896     }  
897     
898     /**********************************************************************************
899      * Additional RPCs added here...
900      **********************************************************************************/
901 }