d46ba8cb4c3389324a73571390d6b33b9cb3a4e9
[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             enum "StopApplication";
114             enum "StartApplication";
115         }
116         description "The action to be taken by APP-C, e.g. Restart, Rebuild, Migrate";
117     }
118
119     /**********************************************************************************
120      * All requests will include this standard header
121      *
122      * The standard request header is used to define a correlation identification for
123      * the request that is returned on all responses.  This correlation identifier
124      * (called the service-request-id) is meaningful to the caller and is included on
125      * all responses from the services.
126      **********************************************************************************/
127     
128
129     /**********************************************************************************
130      * Basic manipulation of a VNF (or VM) will typically include querying the current
131      * state, restarting, rebuilding, stopping, starting, etc.  In all of these basic
132      * "state"-type operations, the services require the identification of the VNF to
133      * be operated on, and the region or LCP that contains that resource.  This
134      * information is used across all of these services, so it has been defined as a
135      * common structure here and is referenced in the appropriate RPC definitions.
136      **********************************************************************************/
137     
138
139     /**********************************************************************************
140      * All responses will include this standard header
141      *
142      * The standard response header includes the time of completion as well as a
143      * success|failure indication
144      **********************************************************************************/
145     
146
147
148        /**********************************************************************************
149          * All requests/response will include this standard header
150          *
151          * The standard common header is used to define a correlation identification for
152          * the request that is returned on all responses.
153          **********************************************************************************/
154     
155     
156     
157     grouping common-header {
158         description "A common header for all APP-C requests";
159         container common-header {
160             description "A common header for all APP-C requests";
161             leaf timestamp {
162                 description "timestamp is in ISO 8601 timestamp format ZULU offset";
163                 type ZULU;
164                 mandatory true;
165             }
166
167             leaf api-ver {
168                 description "api-ver is the API version identifier. A given release of APPC
169                                 should support all previous versions of APPC API (correlate with
170                                 general requirements)";
171                 type string {
172                     pattern "[2]\.\d\d" {
173                         error-message "API Version 2.XX is supported at this end point";
174                     }
175                 }
176                 mandatory true;
177             }
178
179             leaf originator-id {
180                 description "originator-id an identifier of the calling system which can be
181                                 used addressing purposes, i.e. returning asynchronous response
182                                 to the proper destination over DMaaP (especially in case of multiple
183                                 consumers of APP-C APIs)";
184                 type string;
185                 mandatory true;
186             }
187
188             leaf request-id {
189                 description "UUID for the request ID. An OSS/BSS identifier for the request
190                                 that caused the current action. Multiple API calls may be made
191                                 with the same request-id The request-id shall be recorded throughout
192                                 the operations on a single request";
193                 type string;
194                 mandatory true;
195             }
196
197             leaf sub-request-id {
198                 description "Uniquely identifies a specific LCM action. It is persistent over
199                                 the life-cycle of a single request";
200                 type string;
201                 mandatory false;
202             }
203
204
205                 /**********************************************************************************
206                  * Flags are generic flags that apply to any and all commands, all are optional
207                  *  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.
208                  *  ttl = <0....N> - The timeout value for command execution, expressed in seconds
209                  *  mode = EXCLUSIVE/NORMAL - defines execution mode as follows:
210                  *        - EXCLUSIVE ? on encountering an exclusive command, the APP-C will:
211                  *          * Cease accepting additional command requests
212                  *          * Complete execution of outstanding commands
213                  *          * Execute the exclusive command to completion
214                  *          * Optionally report the result of the command
215                  *          * Optionally resume command acceptance and processing
216                  *        - NORMAL - Obverse of EXCLUSIVE, the default one.
217                  **********************************************************************************/
218             container flags {
219                 description "Flags are generic flags that apply to any and all commands, all
220                                 are optional";
221                 leaf mode {
222                     type enumeration {
223                         enum "EXCLUSIVE";
224                         enum "NORMAL";
225                     }
226                     description "EXCLUSIVE (accept no queued requests on this VNF while processing)
227                                         or NORMAL (queue other requests until complete)";
228                     mandatory false;
229                 }
230                 leaf force {
231                     type enumeration {
232                         enum "TRUE";
233                         enum "FALSE";
234                     }
235                     description "TRUE/FALSE - Execute action even if target is in unstable (i.e.
236                                         locked, transiting, etc.) state";
237                     mandatory false;
238                 }
239                 leaf ttl {
240                     description "<0....N> - The timeout value (expressed in seconds) for action
241                                         execution, between action being received by APPC and action initiation";
242                     type uint16;
243                     mandatory false;
244                 }
245                 }
246             }
247         }
248
249
250     grouping action-identifiers {
251         description "A block containing the action arguments. These are used to specify
252                 the object upon which APP-C LCM command is to operate";
253         container action-identifiers {
254             description "A block containing the action arguments. These are used to specify
255                         the object upon which APP-C LCM command is to operate";
256             leaf service-instance-id {
257                 description "identifies a specific service the command refers to. When multiple
258                                 APP-C instances are used and applied to a subset of services,
259                                 this will become significant . The field is mandatory when the
260                                 vnf-id is empty";
261                 type string;
262                 mandatory false;
263             }
264             leaf vnf-id {
265                 description "identifies the VNF to which this action is to be applied(vnf-id
266                                 uniquely identifies the service-instance referred to). Note that
267                                 some actions are applied to multiple VNFs in the same service.
268                                 When this is the case, vnf-id may be left out, but service-instance-id
269                                 must appear. The field is mandatory when service-instance-id is
270                                 empty";
271                 type string;
272                 mandatory false;
273             }
274             leaf vf-module-id {
275                 description "identifies the VF module to which this action is to be applied.";
276                 type string;
277                 mandatory false;
278             }
279             leaf vnfc-name {
280                 description "identifies the VNFC to which this action is to be applied. Some
281                                 actions apply only to a component within a VNF (e.g. RESTART is
282                                 sometimes applied to on VM only). In such a case, the name of
283                                 the VNFC is used to search for the component within the VNF";
284                 type string;
285                 mandatory false;
286             }
287             leaf vserver-id {
288                 description "identifies a specific VM within the given service/vnf to which
289                                 this action is to be applied";
290                 type string;
291                 mandatory false;
292             }
293         }
294     }
295
296
297      grouping 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             container status {
300                 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";
301                 leaf code {
302                     description "Response code";
303                     type uint16;
304                     mandatory true;
305                 }
306                 leaf message {
307                     description "Response message";
308                     type string;
309                     mandatory true;
310                 }
311             }
312       }
313
314
315
316
317
318     /**********************************************************************************
319              * Define the restart service
320              **********************************************************************************/
321             rpc restart {
322                 description "An operation to restart a virtual network function (or VM)";
323                  input {
324                     uses common-header;
325                     leaf action {
326                         type action;
327                         mandatory true;
328                     }
329                     uses action-identifiers;
330                     leaf payload {
331                       type payload;
332                       mandatory false;
333                     }
334                 }
335                 output {
336                     uses common-header;
337                     uses status;
338                 }
339             }
340
341             /**********************************************************************************
342              * Define the rebuild service
343              **********************************************************************************/
344             rpc rebuild {
345                 description "An operation to rebuild a virtual network function (or VM)";
346                 input {
347                     uses common-header;
348                     leaf action {
349                         type action;
350                         mandatory true;
351                     }
352                     uses action-identifiers;
353                     leaf payload {
354                         type payload;
355                         mandatory false;
356                     }
357                 }
358                 output {
359                     uses common-header;
360                     uses status;
361                 }
362             }
363
364             /**********************************************************************************
365              * Define the migrate service
366              **********************************************************************************/
367             rpc migrate {
368                 description "An operation to migrate a virtual network function (or VM)";
369                 input {
370                     uses common-header;
371                     leaf action {
372                         type action;
373                         mandatory true;
374                     }
375                     uses action-identifiers;
376                     leaf payload {
377                         type payload;
378                         mandatory false;
379                     }
380                 }
381                 output {
382                     uses common-header;
383                     uses status;
384                 }
385             }
386
387              /**********************************************************************************
388              * Define the evacuate service
389              **********************************************************************************/
390             rpc evacuate {
391                 description "An operation to evacuate a virtual network function (or VM)";
392                 input {
393                     uses common-header;
394                     leaf action {
395                         type action;
396                         mandatory true;
397                     }
398                     uses action-identifiers;
399                     leaf payload {
400                         type payload;
401                         mandatory false;
402                     }
403                 }
404                 output {
405                     uses common-header;
406                     uses status;
407                 }
408             }
409
410
411          /**********************************************************************************
412          * Define the snapshot service
413          **********************************************************************************/
414         rpc snapshot {
415             description "An operation to create a 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             }
432             output {
433                 uses common-header;
434                 uses status;
435                 leaf snapshot-id {
436                     type string;
437                 }
438
439             }
440         }
441
442          /**********************************************************************************
443          * Define the rollback service
444          **********************************************************************************/
445         rpc rollback {
446             description "An operation to rollback to particular snapshot of a virtual network function (or VM)";
447             input {
448                 uses common-header;
449                 leaf action {
450                   type action;
451                   mandatory true;
452                 }
453                 uses action-identifiers;
454                 leaf payload {
455                   type payload;
456                   mandatory false;
457                 }
458                 leaf identity-url {
459                     type string;
460                      mandatory true;
461                 }
462                 leaf snapshot-id {
463                     type string;
464                      mandatory true;
465                 }
466             }
467             output {
468                 uses common-header;
469                 uses status;
470             }
471         }
472
473
474     /**********************************************************************************
475      * Additional RPCs added here...
476      **********************************************************************************/
477
478
479       /**********************************************************************************
480      * Define the sync service
481      **********************************************************************************/
482     rpc sync {
483         description "An operation to sync the configurations of a virtual network function (or VM)";
484         input {
485             uses common-header;
486             leaf action {
487                        type action;
488                        mandatory true;
489             }
490             uses action-identifiers;
491             leaf payload {
492                 type payload;
493                 mandatory false;
494             }
495         }
496         output {
497             uses common-header;
498             uses status;
499             leaf payload {
500                 type payload;
501                 mandatory false;
502            }
503         }
504     }
505
506     /**********************************************************************************
507      * Define the terminate service
508      **********************************************************************************/
509     rpc terminate {
510         description "An operation to terminate the configurations of a virtual network function (or VM)";
511         input {
512             uses common-header;
513             leaf action {
514                        type action;
515                        mandatory true;
516             }
517             uses action-identifiers;
518             leaf payload {
519                         type payload;
520                         mandatory false;
521             }
522         }
523         output {
524             uses common-header;
525             uses status;
526         }
527     }
528
529
530     rpc configure {
531         description "An operation to configure the configurations of a virtual network
532                 function (or VM)";
533         input {
534             uses common-header;
535             leaf action {
536                 type action;
537                 mandatory true;
538             }
539             uses action-identifiers;
540             leaf payload {
541                 type payload;
542                 mandatory false;
543             }
544         }
545         output {
546             uses common-header;
547             uses status;
548             leaf payload {
549                  type payload;
550                  mandatory false;
551             }
552         }
553     }
554
555     rpc config-modify {
556         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";
557         input {
558             uses common-header;
559             leaf action {
560                 type action;
561                 mandatory true;
562             }
563             uses action-identifiers;
564             leaf payload {
565                 type payload;
566                 mandatory false;
567             }
568         }
569         output {
570             uses common-header;
571             uses status;
572             leaf payload {
573                  type payload;
574                  mandatory false;
575             }
576         }
577     }
578
579     rpc config-scaleout {
580         description "An operation to scaleout the configurations of a virtual network
581                 function (or VM)";
582         input {
583             uses common-header;
584             leaf action {
585                 type action;
586                 mandatory true;
587             }
588             uses action-identifiers;
589             leaf payload {
590                 type payload;
591                 mandatory false;
592             }
593         }
594         output {
595             uses common-header;
596             uses status;
597             leaf payload {
598                  type payload;
599                  mandatory false;
600             }
601         }
602     }
603
604     rpc config-restore {
605         description "An operation to restore the configurations of a virtual network
606                 function (or VM)";
607         input {
608             uses common-header;
609             leaf action {
610                 type action;
611                 mandatory true;
612             }
613             uses action-identifiers;
614             leaf payload {
615                 type payload;
616                 mandatory false;
617             }
618         }
619         output {
620             uses common-header;
621             uses status;
622             leaf payload {
623                  type payload;
624                  mandatory false;
625             }
626         }
627     }
628
629     /**********************************************************************************
630          * Define the test service
631          **********************************************************************************/
632     rpc test {
633         description "An operation to test the configurations of a virtual network function (or VM)";
634         input {
635             uses common-header;
636             leaf action {
637                        type action;
638                        mandatory true;
639             }
640             uses action-identifiers;
641             leaf payload {
642                         type payload;
643                         mandatory false;
644             }
645         }
646         output {
647             uses common-header;
648             uses status;
649         }
650     }
651
652         /**********************************************************************************
653          * Define the stop service
654          **********************************************************************************/
655         rpc stop {
656             description "An operation to stop the configurations of a virtual network function (or VM)";
657             input {
658                 uses common-header;
659                 leaf action {
660                            type action;
661                            mandatory true;
662                 }
663                 uses action-identifiers;
664                 leaf payload {
665                             type payload;
666                             mandatory false;
667                 }
668             }
669             output {
670                 uses common-header;
671                 uses status;
672             }
673         }
674
675         rpc start {
676             description "An operation to start a virtual network function (or VM)";
677             input {
678                 uses common-header;
679                 leaf action {
680                     type action;
681                     mandatory true;
682                 }
683                 uses action-identifiers;
684                 leaf payload {
685                     type payload;
686                     mandatory false;
687                 }
688             }
689             output {
690                 uses common-header;
691                 uses status;
692             }
693         }
694
695        /**********************************************************************************
696         * Define the audit service
697         **********************************************************************************/
698        rpc audit {
699            description "An operation to audit the configurations of a virtual network function (or VM)";
700            input {
701                uses common-header;
702                leaf action {
703                           type action;
704                           mandatory true;
705                }
706                uses action-identifiers;
707                leaf payload {
708                    type payload;
709                    mandatory false;
710                }
711            }
712            output {
713                uses common-header;
714                uses status;
715                leaf payload {
716                    type payload;
717                    mandatory false;
718               }
719            }
720        }
721
722        /**********************************************************************************
723        * Define the SoftwareUpload vSCP service
724        **********************************************************************************/
725       rpc software-upload {
726           description "An operation to upload a new version of vSCP image to vSCP for updating it";
727           input {
728               uses common-header;
729               leaf action {
730                          type action;
731                          mandatory true;
732               }
733               uses action-identifiers;
734               leaf payload {
735                           type payload;
736                           mandatory false;
737               }
738           }
739           output {
740               uses common-header;
741               uses status;
742           }
743       }
744
745
746
747       /**********************************************************************************
748            * Define the PreHealthCheck vSCP service
749            **********************************************************************************/
750           rpc health-check {
751               description "An operation to perform health check of vSCP prior its upgrading";
752               input {
753                   uses common-header;
754                   leaf action {
755                              type action;
756                              mandatory true;
757                   }
758                   uses action-identifiers;
759                   leaf payload {
760                                                    type payload;
761                                                    mandatory false;
762                                        }
763               }
764               output {
765                   uses common-header;
766                   uses status;
767
768               }
769           }
770
771
772     /**********************************************************************************
773               * Define the Upgrade vSCP service
774               **********************************************************************************/
775              rpc live-upgrade {
776                  description "An operation to perform upgrade of vSCP";
777                  input {
778                      uses common-header;
779                      leaf action {
780                                 type action;
781                                 mandatory true;
782                      }
783                      uses action-identifiers;
784                      leaf payload {
785                                  type payload;
786                                  mandatory false;
787                      }
788                  }
789                  output {
790                      uses common-header;
791                      uses status;
792                  }
793              }
794
795
796      /**********************************************************************************
797                      * Define the VNF lock service
798                      **********************************************************************************/
799                     rpc lock {
800                         description "An operation to perform VNF lock operation";
801                         input {
802                             uses common-header;
803                             leaf action {
804                                        type action;
805                                        mandatory true;
806                             }
807                             uses action-identifiers;
808                             leaf payload {
809                                         type payload;
810                                         mandatory false;
811                             }
812                         }
813                         output {
814                             uses common-header;
815                             uses status;
816                         }
817                     }
818
819         /**********************************************************************************
820          * Define the VNF unlock service
821          **********************************************************************************/
822                         rpc unlock {
823                             description "An operation to perform VNF unlock operation";
824                             input {
825                                 uses common-header;
826                                 leaf action {
827                                            type action;
828                                            mandatory true;
829                                 }
830                                 uses action-identifiers;
831                                 leaf payload {
832                                             type payload;
833                                             mandatory false;
834                                 }
835                             }
836                             output {
837                                 uses common-header;
838                                 uses status;
839                             }
840                         }
841
842      /**********************************************************************************
843      * Define the VNF check lock service
844      **********************************************************************************/
845     rpc check-lock {
846         description "An operation to check VNF lock status";
847         input {
848             uses common-header;
849             leaf action {
850                        type action;
851                        mandatory true;
852             }
853             uses action-identifiers;
854         }
855         output {
856             uses common-header;
857             uses status;
858             leaf locked {
859                 type enumeration {
860                             enum "TRUE";
861                             enum "FALSE";
862                        }
863                 description "TRUE/FALSE - returns TRUE when the given VNF was locked, otherwise returns FALSE";
864                 mandatory false;
865             }
866         }
867     }
868
869
870     rpc config-backup {
871         description "An operation to Backup configurations of a virtual network function
872                 (or VM)";
873         input {
874             uses common-header;
875             leaf action {
876                 type action;
877                 mandatory true;
878             }
879             uses action-identifiers;
880         }
881         output {
882             uses common-header;
883             uses status;
884             leaf payload {
885                  type payload;
886                  mandatory false;
887             }
888         }
889     }
890
891     rpc config-backup-delete {
892         description "An operation to Delete backup configurations of a virtual network
893                 function (or VM)";
894         input {
895             uses common-header;
896             leaf action {
897                 type action;
898                 mandatory true;
899             }
900             uses action-identifiers;
901         }
902         output {
903             uses common-header;
904             uses status;
905             leaf payload {
906                  type payload;
907                  mandatory false;
908             }
909         }
910     }
911
912     rpc config-export {
913         description "An operation to Export configurations of a virtual network function
914                 (or VM)";
915         input {
916             uses common-header;
917             leaf action {
918                 type action;
919                 mandatory true;
920             }
921             uses action-identifiers;
922         }
923         output {
924             uses common-header;
925             uses status;
926         }
927     }
928     rpc stop-application {
929             description "An operation to Stop Application traffic to a virtual network function";
930             input {
931                 uses common-header;
932                 leaf action {
933                     type action;
934                     mandatory true;
935                 }
936                 uses action-identifiers;
937                 leaf payload {
938                      type payload;
939                      mandatory false;
940                 }
941             }
942             output {
943                 uses common-header;
944                 uses status;
945             }
946       }
947
948     rpc start-application {
949                 description "An operation to Start Application traffic to a virtual network function";
950                 input {
951                     uses common-header;
952                     leaf action {
953                         type action;
954                         mandatory true;
955                     }
956                     uses action-identifiers;
957                     leaf payload {
958                          type payload;
959                          mandatory false;
960                     }
961                 }
962                 output {
963                     uses common-header;
964                     uses status;
965                 }
966        }
967     /**********************************************************************************
968      * Additional RPCs added here...
969      **********************************************************************************/
970 }