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