aboutsummaryrefslogtreecommitdiffstats
path: root/appc-dispatcher/appc-request-handler/appc-request-handler-api/src/main
diff options
context:
space:
mode:
authorPatrick Brady <pb071s@att.com>2017-02-15 23:11:26 -0800
committerPatrick Brady <pb071s@att.com>2017-02-15 23:13:06 -0800
commit1c192d2dd68724e292b6a30f463085a262e1e813 (patch)
treed0e2b3a396e169863cd0efaa835c8675e9d5aaac /appc-dispatcher/appc-request-handler/appc-request-handler-api/src/main
parentc69ba05c7508aa7d7f675189a45c8c87569369ef (diff)
Moving all files to root directory
Change-Id: Ica5535fd6ec85f350fe1640b42137b49f83f10f0 Signed-off-by: Patrick Brady <pb071s@att.com>
Diffstat (limited to 'appc-dispatcher/appc-request-handler/appc-request-handler-api/src/main')
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-api/src/main/java/org/openecomp/appc/message/RequestHandlerMessages.java28
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-api/src/main/java/org/openecomp/appc/requesthandler/RequestHandler.java77
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-api/src/main/java/org/openecomp/appc/requesthandler/objects/RequestHandlerInput.java58
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-api/src/main/java/org/openecomp/appc/requesthandler/objects/RequestHandlerOutput.java48
4 files changed, 211 insertions, 0 deletions
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-api/src/main/java/org/openecomp/appc/message/RequestHandlerMessages.java b/appc-dispatcher/appc-request-handler/appc-request-handler-api/src/main/java/org/openecomp/appc/message/RequestHandlerMessages.java
new file mode 100644
index 000000000..c397f09cd
--- /dev/null
+++ b/appc-dispatcher/appc-request-handler/appc-request-handler-api/src/main/java/org/openecomp/appc/message/RequestHandlerMessages.java
@@ -0,0 +1,28 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.message;
+
+
+public class RequestHandlerMessages {
+ public final static String VNF_WORKING_STATE_UPDATED = "VNF WorkingState for vnfId ${vnfId} was updated to ${workingState} at attempt ${attempt} out of ${maxAttempts} with ownerId = ${ownerId} and forceFlag = ${forceFlag}";
+ public final static String VNF_WORKING_STATE_WAS_NOT_UPDATED = "VNF WorkingState for vnfId ${vnfId} was not updated to ${workingState} attempt ${attempt} out of ${maxAttempts} with ownerId = ${ownerId} and forceFlag = ${forceFlag}";
+}
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-api/src/main/java/org/openecomp/appc/requesthandler/RequestHandler.java b/appc-dispatcher/appc-request-handler/appc-request-handler-api/src/main/java/org/openecomp/appc/requesthandler/RequestHandler.java
new file mode 100644
index 000000000..d0d54c9db
--- /dev/null
+++ b/appc-dispatcher/appc-request-handler/appc-request-handler-api/src/main/java/org/openecomp/appc/requesthandler/RequestHandler.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.requesthandler;
+
+import org.openecomp.appc.domainmodel.lcm.RuntimeContext;
+import org.openecomp.appc.executor.UnstableVNFException;
+import org.openecomp.appc.requesthandler.objects.RequestHandlerInput;
+import org.openecomp.appc.requesthandler.objects.RequestHandlerOutput;
+
+/**
+ * This class provides application logic for the Request/Response Handler Component.
+ *
+ */
+public interface RequestHandler {
+ /**
+ * It receives requests from the north-bound REST API (Communication) Layer and
+ * performs following validations.
+ * 1. VNF exists in A&AI for the given targetID (VnfID)
+ * 2. For the current VNF Orchestration Status, the command can be executed
+ * 3. For the given VNF type and Operation, there exists work-flow definition in the APPC database
+ * If any of the validation fails, it returns appropriate response
+ *
+ * @param input RequestHandlerInput object which contains request header and other request parameters like command , target Id , payload etc.
+ * @return response for request as enum with Return code and message.
+ */
+ RequestHandlerOutput handleRequest(RequestHandlerInput input);
+
+ /**
+ * 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.
+ * @param vnf_id vnf id or target Id on which updates required
+ * @param requestIdentifierString - string contains id uniquely represents the request
+ * @param forceFlag
+ * @return true in case AAI updates are successful. false for any error or exception.
+ */
+ void onRequestExecutionStart(String vnf_id, boolean readOnlyActivity, String requestIdentifierString, boolean forceFlag) throws UnstableVNFException;
+
+ /**
+ * This method perform following operations required after execution of workflow.
+ * It posts asynchronous response to message bus (DMaaP).
+ * Unlock VNF Id
+ * Removes request from request registry.
+ * Generate audit logs.
+ * Adds transaction record to database id if transaction logging is enabled.
+ * @param runtimeContext RuntimeContext object which contains all parameters from request, response and few parameters from AA&I
+ * @param isAAIUpdated boolean flag which indicate AAI upodate status after request completion.
+ */
+ void onRequestExecutionEnd(RuntimeContext runtimeContext, boolean isAAIUpdated);
+
+ /**
+ * This method perform following operations required if TTL ends when request still waiting in execution queue .
+ * It posts asynchronous response to message bus (DMaaP).
+ * Unlock VNF Id
+ * Removes request from request registry.
+ * @param runtimeContext RuntimeContext object which contains all parameters from request, response and few parameters from AA&I;
+ * @param updateAAI boolean flag which indicate AAI upodate status after request completion.
+ */
+ void onRequestTTLEnd(RuntimeContext runtimeContext, boolean updateAAI);
+}
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-api/src/main/java/org/openecomp/appc/requesthandler/objects/RequestHandlerInput.java b/appc-dispatcher/appc-request-handler/appc-request-handler-api/src/main/java/org/openecomp/appc/requesthandler/objects/RequestHandlerInput.java
new file mode 100644
index 000000000..70d9b84e8
--- /dev/null
+++ b/appc-dispatcher/appc-request-handler/appc-request-handler-api/src/main/java/org/openecomp/appc/requesthandler/objects/RequestHandlerInput.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.requesthandler.objects;
+
+import org.openecomp.appc.domainmodel.lcm.RequestContext;
+
+public class RequestHandlerInput {
+
+
+ private RequestContext requestContext;
+ private String rpcName;
+
+ public String getRpcName() {
+ return rpcName;
+ }
+
+ public void setRpcName(String rpcName) {
+ this.rpcName = rpcName;
+ }
+
+ public RequestContext getRequestContext() {
+ return requestContext;
+ }
+
+ public RequestHandlerInput(){
+ }
+
+
+ public void setRequestContext(RequestContext requestContext) {
+ this.requestContext = requestContext;
+ }
+
+ @Override
+ public String toString() {
+ return "RequestHandlerInput{" +
+ "requestContext=" + requestContext +
+ '}';
+ }
+}
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-api/src/main/java/org/openecomp/appc/requesthandler/objects/RequestHandlerOutput.java b/appc-dispatcher/appc-request-handler/appc-request-handler-api/src/main/java/org/openecomp/appc/requesthandler/objects/RequestHandlerOutput.java
new file mode 100644
index 000000000..051c02708
--- /dev/null
+++ b/appc-dispatcher/appc-request-handler/appc-request-handler-api/src/main/java/org/openecomp/appc/requesthandler/objects/RequestHandlerOutput.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.requesthandler.objects;
+
+import org.openecomp.appc.domainmodel.lcm.ResponseContext;
+
+public class RequestHandlerOutput {
+
+ private ResponseContext responseContext;
+
+ public RequestHandlerOutput(){
+
+ }
+
+ public ResponseContext getResponseContext() {
+ return responseContext;
+ }
+
+ public void setResponseContext(ResponseContext responseContext) {
+ this.responseContext = responseContext;
+ }
+
+ @Override
+ public String toString() {
+ return "RequestHandlerOutput{" +
+ "responseContext=" + responseContext +
+ '}';
+ }
+}