2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.openecomp.appc.requesthandler;
24 import org.openecomp.appc.domainmodel.lcm.RuntimeContext;
25 import org.openecomp.appc.executor.UnstableVNFException;
26 import org.openecomp.appc.requesthandler.objects.RequestHandlerInput;
27 import org.openecomp.appc.requesthandler.objects.RequestHandlerOutput;
30 * This class provides application logic for the Request/Response Handler Component.
33 public interface RequestHandler {
35 * It receives requests from the north-bound REST API (Communication) Layer and
36 * performs following validations.
37 * 1. VNF exists in A&AI for the given targetID (VnfID)
38 * 2. For the current VNF Orchestration Status, the command can be executed
39 * 3. For the given VNF type and Operation, there exists work-flow definition in the APPC database
40 * If any of the validation fails, it returns appropriate response
42 * @param input RequestHandlerInput object which contains request header and other request parameters like command , target Id , payload etc.
43 * @return response for request as enum with Return code and message.
45 RequestHandlerOutput handleRequest(RequestHandlerInput input);
48 * This method perform operations required before execution of workflow starts. It retrieves next state for current operation from Lifecycle manager and update it in AAI.
49 * @param vnf_id vnf id or target Id on which updates required
50 * @param requestIdentifierString - string contains id uniquely represents the request
52 * @return true in case AAI updates are successful. false for any error or exception.
54 void onRequestExecutionStart(String vnf_id, boolean readOnlyActivity, String requestIdentifierString, boolean forceFlag) throws UnstableVNFException;
57 * This method perform following operations required after execution of workflow.
58 * It posts asynchronous response to message bus (DMaaP).
60 * Removes request from request registry.
61 * Generate audit logs.
62 * Adds transaction record to database id if transaction logging is enabled.
63 * @param runtimeContext RuntimeContext object which contains all parameters from request, response and few parameters from AA&I
64 * @param isAAIUpdated boolean flag which indicate AAI upodate status after request completion.
66 void onRequestExecutionEnd(RuntimeContext runtimeContext, boolean isAAIUpdated);
69 * This method perform following operations required if TTL ends when request still waiting in execution queue .
70 * It posts asynchronous response to message bus (DMaaP).
72 * Removes request from request registry.
73 * @param runtimeContext RuntimeContext object which contains all parameters from request, response and few parameters from AA&I;
74 * @param updateAAI boolean flag which indicate AAI upodate status after request completion.
76 void onRequestTTLEnd(RuntimeContext runtimeContext, boolean updateAAI);