2 * ============LICENSE_START=======================================================
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 * ============LICENSE_END=========================================================
25 package org.onap.appc.requesthandler;
27 import org.onap.appc.domainmodel.lcm.RuntimeContext;
28 import org.onap.appc.exceptions.APPCException;
29 import org.onap.appc.requesthandler.objects.RequestHandlerInput;
30 import org.onap.appc.requesthandler.objects.RequestHandlerOutput;
33 * This class provides application logic for the Request/Response Handler Component.
36 public interface RequestHandler {
38 * It receives requests from the north-bound REST API (Communication) Layer and
39 * performs following validations.
40 * 1. VNF exists in A&AI for the given targetID (VnfID)
41 * 2. For the current VNF Orchestration Status, the command can be executed
42 * 3. For the given VNF type and Operation, there exists work-flow definition in the APPC database
43 * If any of the validation fails, it returns appropriate response
45 * @param input RequestHandlerInput object which contains request header and other request parameters like command , target Id , payload etc.
46 * @return response for request as enum with Return code and message.
48 RequestHandlerOutput handleRequest(RequestHandlerInput input);
51 * 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.
52 * @param vnf_id vnf id or target Id on which updates required
54 * @return true in case AAI updates are successful. false for any error or exception.
56 void onRequestExecutionStart(String vnf_id, boolean readOnlyActivity, boolean forceFlag) ;
59 * This method perform following operations required after execution of workflow.
60 * It posts asynchronous response to message bus (DMaaP).
62 * Removes request from request registry.
63 * Generate audit logs.
64 * Adds transaction record to database id if transaction logging is enabled.
65 * @param runtimeContext RuntimeContext object which contains all parameters from request, response and few parameters from AA&I
67 void onRequestExecutionEnd(RuntimeContext runtimeContext);
70 * This method returns the count of in progress requests
71 * * @return in progress requests count
73 int getInprogressRequestCount() throws APPCException;