2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright (C) 2017 Amdocs
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=========================================================
20 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 package org.openecomp.appc.requesthandler;
25 import org.openecomp.appc.domainmodel.lcm.RuntimeContext;
26 import org.openecomp.appc.executor.UnstableVNFException;
27 import org.openecomp.appc.requesthandler.objects.RequestHandlerInput;
28 import org.openecomp.appc.requesthandler.objects.RequestHandlerOutput;
31 * This class provides application logic for the Request/Response Handler Component.
34 public interface RequestHandler {
36 * It receives requests from the north-bound REST API (Communication) Layer and
37 * performs following validations.
38 * 1. VNF exists in A&AI for the given targetID (VnfID)
39 * 2. For the current VNF Orchestration Status, the command can be executed
40 * 3. For the given VNF type and Operation, there exists work-flow definition in the APPC database
41 * If any of the validation fails, it returns appropriate response
43 * @param input RequestHandlerInput object which contains request header and other request parameters like command , target Id , payload etc.
44 * @return response for request as enum with Return code and message.
46 RequestHandlerOutput handleRequest(RequestHandlerInput input);
49 * 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.
50 * @param vnf_id vnf id or target Id on which updates required
51 * @param requestIdentifierString - string contains id uniquely represents the request
53 * @return true in case AAI updates are successful. false for any error or exception.
55 void onRequestExecutionStart(String vnf_id, boolean readOnlyActivity, String requestIdentifierString, boolean forceFlag) throws UnstableVNFException;
58 * This method perform following operations required after execution of workflow.
59 * It posts asynchronous response to message bus (DMaaP).
61 * Removes request from request registry.
62 * Generate audit logs.
63 * Adds transaction record to database id if transaction logging is enabled.
64 * @param runtimeContext RuntimeContext object which contains all parameters from request, response and few parameters from AA&I
65 * @param isAAIUpdated boolean flag which indicate AAI upodate status after request completion.
67 void onRequestExecutionEnd(RuntimeContext runtimeContext, boolean isAAIUpdated);
70 * This method perform following operations required if TTL ends when request still waiting in execution queue .
71 * It posts asynchronous response to message bus (DMaaP).
73 * Removes request from request registry.
74 * @param runtimeContext RuntimeContext object which contains all parameters from request, response and few parameters from AA&I;
75 * @param updateAAI boolean flag which indicate AAI upodate status after request completion.
77 void onRequestTTLEnd(RuntimeContext runtimeContext, boolean updateAAI);
80 * This method returns the count of in progress requests
81 * * @return in progress requests count
83 int getInprogressRequestCount();