aboutsummaryrefslogtreecommitdiffstats
path: root/appc-dispatcher/appc-command-executor
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-command-executor
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-command-executor')
-rw-r--r--appc-dispatcher/appc-command-executor/.gitignore1
-rw-r--r--appc-dispatcher/appc-command-executor/.settings/org.eclipse.wst.common.project.facet.core.xml4
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/.gitignore1
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/.settings/org.eclipse.wst.common.project.facet.core.xml4
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/pom.xml60
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/CommandExecutor.java41
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/UnstableVNFException.java29
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/conv/Converter.java49
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandExecutorInput.java54
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandResponse.java38
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/LCMCommandStatus.java112
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/Params.java57
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/UniqueRequestIdentifier.java123
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/.gitignore1
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/.settings/org.eclipse.wst.common.project.facet.core.xml4
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/pom.xml105
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandExecutorImpl.java153
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandTask.java126
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandTaskFactory.java65
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommonMethods.java72
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/ExpiredMessageHandler.java45
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMCommandTask.java261
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMReadonlyCommandTask.java81
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/objects/CommandRequest.java89
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/objects/LCMCommandRequest.java32
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/objects/LCMReadOnlyCommandRequest.java33
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml51
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/resources/org/openecomp/appc/default.properties48
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutionTask.java312
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutor.java157
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/resources/org/openecomp/appc/default.properties102
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-features/.gitignore3
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-features/pom.xml107
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-features/src/main/resources/features.xml35
-rw-r--r--appc-dispatcher/appc-command-executor/pom.xml22
35 files changed, 2477 insertions, 0 deletions
diff --git a/appc-dispatcher/appc-command-executor/.gitignore b/appc-dispatcher/appc-command-executor/.gitignore
new file mode 100644
index 000000000..b83d22266
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/appc-dispatcher/appc-command-executor/.settings/org.eclipse.wst.common.project.facet.core.xml b/appc-dispatcher/appc-command-executor/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644
index 000000000..f4ef8aa0a
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <installed facet="java" version="1.8"/>
+</faceted-project>
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/.gitignore b/appc-dispatcher/appc-command-executor/appc-command-executor-api/.gitignore
new file mode 100644
index 000000000..b83d22266
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/.settings/org.eclipse.wst.common.project.facet.core.xml b/appc-dispatcher/appc-command-executor/appc-command-executor-api/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644
index 000000000..f4ef8aa0a
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <installed facet="java" version="1.8"/>
+</faceted-project>
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/pom.xml b/appc-dispatcher/appc-command-executor/appc-command-executor-api/pom.xml
new file mode 100644
index 000000000..645f0b630
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/pom.xml
@@ -0,0 +1,60 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-command-executor</artifactId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>appc-command-executor-api</artifactId>
+ <packaging>bundle</packaging>
+
+ <name>appc-command-executor-api</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>execution-queue-management-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>domain-model-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!--<dependency>-->
+ <!--<groupId>org.apache.commons</groupId>-->
+ <!--<artifactId>commons-lang3</artifactId>-->
+ <!--<version>3.4</version>-->
+ <!--<scope>provided</scope>-->
+ <!--<type>bundle</type>-->
+ <!--</dependency>-->
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Version>${project.version}</Bundle-Version>
+ <Export-Package>org.openecomp.appc.executor,org.openecomp.appc.executor.objects,org.openecomp.appc.executor.conv,org.openecomp.appc.executor.helper</Export-Package>
+ <Embed-Dependency>appc-common,eelf-core,logback-core,logback-classic,javax.json;scope=compile|runtime;inline=false</Embed-Dependency>
+ <Embed-Transitive>true</Embed-Transitive>
+ <Import-Package>!groovy.lang,!javax.*,!org.apache.log,!org.apache.log4j.*,!org.codehaus.jackson.*,!org.codehaus.jackson.map.*,!org.codehaus.commons.compiler,!org.codehaus.groovy.*,!org.codehaus.janino,!org.jasypt.*,!com.ibm.icu.*,!com.sun.faces.*,*</Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/CommandExecutor.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/CommandExecutor.java
new file mode 100644
index 000000000..ac5223b93
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/CommandExecutor.java
@@ -0,0 +1,41 @@
+/*-
+ * ============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.executor;
+
+
+import org.openecomp.appc.exceptions.APPCException;
+import org.openecomp.appc.executor.objects.CommandExecutorInput;
+
+
+
+public interface CommandExecutor {
+ /**
+ * Execute given command
+ * Create command request and enqueue it for execution.
+ * @param commandHeaderInput Contains CommandHeader, command , target Id , payload and conf ID (optional)
+ * @throws APPCException in case of error.
+ */
+ void executeCommand(CommandExecutorInput commandHeaderInput) throws APPCException;
+}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/UnstableVNFException.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/UnstableVNFException.java
new file mode 100644
index 000000000..3727cdb40
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/UnstableVNFException.java
@@ -0,0 +1,29 @@
+/*-
+ * ============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.executor;
+
+
+public class UnstableVNFException extends Exception{
+ public UnstableVNFException(String message){
+ super(message);
+ }
+}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/conv/Converter.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/conv/Converter.java
new file mode 100644
index 000000000..a9991e43e
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/conv/Converter.java
@@ -0,0 +1,49 @@
+/*-
+ * ============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.executor.conv;
+
+import java.io.IOException;
+
+import org.openecomp.appc.executor.objects.Params;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+
+public class Converter {
+
+ public static Params convJsonStringToParams(String inObj) throws IOException {
+ Params outObj = null;
+ if(inObj != null) {
+ outObj = new ObjectMapper().readValue(inObj, Params.class);
+ }
+ return outObj;
+ }
+
+ public static String convParamsToJsonString(Params inObj) throws JsonProcessingException {
+ String outObj = null;
+ if(inObj != null) {
+ outObj = new ObjectMapper().writeValueAsString(inObj);
+ }
+ return outObj;
+ }
+}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandExecutorInput.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandExecutorInput.java
new file mode 100644
index 000000000..4cb5f1b99
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandExecutorInput.java
@@ -0,0 +1,54 @@
+/*-
+ * ============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.executor.objects;
+
+import org.openecomp.appc.domainmodel.lcm.RuntimeContext;
+
+public class CommandExecutorInput {
+ private RuntimeContext runtimeContext ;
+ private int ttl;
+
+
+ public RuntimeContext getRuntimeContext() {
+ return runtimeContext;
+ }
+
+ public void setRuntimeContext(RuntimeContext runtimeContext) {
+ this.runtimeContext = runtimeContext;
+ }
+
+ public int getTtl() {
+ return ttl;
+ }
+
+ public void setTtl(int ttl) {
+ this.ttl = ttl;
+ }
+
+ @Override
+ public String toString() {
+ return "CommandExecutorInput{" +
+ "runtimeContext=" + runtimeContext +
+ ", ttl=" + ttl +
+ '}';
+ }
+}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandResponse.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandResponse.java
new file mode 100644
index 000000000..c973fcde1
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandResponse.java
@@ -0,0 +1,38 @@
+/*-
+ * ============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.executor.objects;
+
+import org.openecomp.appc.domainmodel.lcm.RuntimeContext;
+
+
+public class CommandResponse {
+
+ private RuntimeContext runtimeContext;
+
+ public RuntimeContext getRuntimeContext() {
+ return runtimeContext;
+ }
+
+ public void setRuntimeContext(RuntimeContext runtimeContext) {
+ this.runtimeContext = runtimeContext;
+ }
+}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/LCMCommandStatus.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/LCMCommandStatus.java
new file mode 100644
index 000000000..4e3a40e75
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/LCMCommandStatus.java
@@ -0,0 +1,112 @@
+/*-
+ * ============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.executor.objects;
+
+
+import org.apache.commons.lang3.StringUtils;
+import org.openecomp.appc.util.MessageFormatter;
+
+import java.util.Map;
+
+public enum LCMCommandStatus {
+
+ ACCEPTED(100,"ACCEPTED - request accepted"),
+
+ //ERROR(2xx) – request can’t be handled due to some technical error
+ UNEXPECTED_ERROR(200,"UNEXPECTED ERROR - ${errorMsg}"),
+
+ //REJECT(3xx) – request has been rejected due to some business reason (e.g. no such service-instance-id, command is not supported, etc)
+ REJECTED(300,"REJECTED - ${errorMsg}"),
+ INVALID_INPUT_PARAMETER(301,"INVALID INPUT PARAMETER - ${errorMsg}"),// TODO 77777777 to support "${paramName} with invalid value ${paramValue}"
+ MISSING_MANDATORY_PARAMETER(302,"MISSING MANDATORY PARAMETER - Parameter/s ${paramName} is/are missing" ),
+ REQUEST_PARSING_FAILED(303,"REQUEST PARSING FAILED - ${errorMsg}"),
+ NO_TRANSITION_DEFINE(304,"ACTION IS NOT ALLOWED - Action ${actionName} is not allowed for VNF in state ${currentState}"),
+ ACTION_NOT_SUPPORTED(305,"ACTION NOT SUPPORTED - ${actionName} action is not supported" ),
+ VNF_NOT_FOUND(306,"VNF NOT FOUND - VNF with ID ${vnfId} was not found" ),
+ DG_WORKFLOW_NOT_FOUND(307,"DG WORKFLOW NOT FOUND - No DG workflow found for the combination of ${dgModule} module ${dgName} name and ${dgVersion} version"),//TODO need to support it
+ WORKFLOW_NOT_FOUND(308,"WORKFLOW NOT FOUND - No workflow found for VNF type ${vnfTypeVersion} and ${actionName} action"),
+ UNSTABLE_VNF(309,"UNSTABLE VNF - VNF ${vnfId} is not stable to accept the command"),
+ LOCKING_FAILURE(310,"LOCKING FAILURE - ${errorMsg}" ),
+ EXPIRED_REQUEST(311,"EXPIRED REQUEST"),
+ DUPLICATE_REQUEST(312,"DUPLICATE REQUEST"),
+
+ SUCCESS(400,"SUCCESS - request has been processed successfully"),
+
+
+ // FAILURE(5xx) – request processing results with failure. The FAILURE response is always transmitted asynchronously, via DMaaP.
+ DG_FAILURE(401,"DG FAILURE - ${errorMsg}"),
+ NO_TRANSITION_DEFINE_FAILURE(402,"NO TRANSITION DEFINE - No Transition Defined for ${actionName} action and ${currentState} state"),
+ UPDATE_AAI_FAILURE(403,"UPDATE_AAI_FAILURE - failed to update AAI. ${errorMsg}"),
+ EXPIRED_REQUEST_FAILURE(404,"EXPIRED REQUEST FAILURE - failed after accepted because TTL expired"),
+ UNEXPECTED_FAILURE(405,"UNEXPECTED FAILURE - ${errorMsg}"),
+ UNSTABLE_VNF_FAILURE(406,"UNSTABLE VNF FAILURE - VNF ${vnfId} is not stable to accept the command"),
+
+ ;
+
+
+ public static final String errorDgMessageParamName = "errorDgMessage";
+
+ private int responseCode;
+ private String responseMessage;
+
+
+
+
+ LCMCommandStatus(int responseCode, String responseMessage) {
+ this.responseCode = responseCode;
+ this.responseMessage = responseMessage;
+ }
+
+ public String getResponseMessage() {
+ return responseMessage;
+ }
+
+ public int getResponseCode() {
+ return responseCode;
+ }
+
+
+ /**
+ *
+ * @return messageTemplate
+ */
+
+
+ public String getFormattedMessage(Params params){
+ Map<String,Object> paramsMap = params != null ? params.getParams() : null;
+ return MessageFormatter.format(getResponseMessage(),paramsMap);
+
+ }
+
+ public String getFormattedMessageWithCode(Params params){
+ return getResponseCode()+"-" + getFormattedMessage(params);
+ }
+
+ @Override
+ public String toString() {
+ return "LCMCommandStatus{" +
+ "responseCode=" + responseCode +
+ ", responseMessage='" + responseMessage + '\'' +
+ '}';
+ }
+}
+
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/Params.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/Params.java
new file mode 100644
index 000000000..8db4f6576
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/Params.java
@@ -0,0 +1,57 @@
+/*-
+ * ============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.executor.objects;
+
+import java.lang.Object;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public class Params {
+ public static final String paramDgNameSpace = "dg.status.message.param.";
+ public static final String errorDgMessageParamName = "errorDgMessage";
+ private Map<String, java.lang.Object> params;
+
+ public Params() {
+ }
+
+ public Map<String, java.lang.Object> getParams() {
+ return params;
+ }
+
+ public void setParams(Map<String, java.lang.Object> params) {
+ this.params = params;
+ }
+
+ public Params addParam(String paramName, java.lang.Object paramValue) {
+ params = params == null ? new HashMap<String, Object>() : params;
+ params.put(paramName, paramValue);
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return "Params{" +
+ "params=" + params +
+ '}';
+ }
+}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/UniqueRequestIdentifier.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/UniqueRequestIdentifier.java
new file mode 100644
index 000000000..0e33ca4c2
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/UniqueRequestIdentifier.java
@@ -0,0 +1,123 @@
+/*-
+ * ============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.executor.objects;
+
+
+import org.apache.commons.lang3.StringUtils;
+
+
+public class UniqueRequestIdentifier {
+ private static final String IDENTIFIER_DELIMITER = "@";
+
+ private String originatorID;
+ private String requestID;
+ private String subRequestID;
+
+ private UniqueRequestIdentifier(){
+
+ }
+ public UniqueRequestIdentifier(String originatorID,
+ String requestID,
+ String subRequestID) {
+ this();
+ this.originatorID = originatorID;
+ this.requestID = requestID;
+ this.subRequestID = subRequestID;
+ }
+
+ public String toIdentifierString(){
+ StringBuilder stringBuilder = new StringBuilder();
+ if(originatorID != null){
+ stringBuilder.append(originatorID);
+ }
+ stringBuilder.append(IDENTIFIER_DELIMITER);
+
+ if(requestID != null){
+ stringBuilder.append(requestID);
+ }
+ stringBuilder.append(IDENTIFIER_DELIMITER);
+
+ if(subRequestID != null){
+ stringBuilder.append(subRequestID);
+ }
+ return stringBuilder.toString();
+ }
+
+ public static UniqueRequestIdentifier getUniqueRequestIdentifier(String identifierString){
+ String[] splitIdentifier = identifierString.split(IDENTIFIER_DELIMITER);
+ if(splitIdentifier == null || splitIdentifier.length <2){
+ throw new IllegalArgumentException("input identifierString is not valid "+identifierString);
+ }
+ String originatorID = splitIdentifier[0];
+ String requestID = StringUtils.isEmpty(splitIdentifier[1])? null :splitIdentifier[1];
+ String subRequestID = splitIdentifier.length>=3 ? splitIdentifier[2] : null;
+ return new UniqueRequestIdentifier(originatorID,requestID,subRequestID);
+ }
+ public String toString(){
+ return "originatorID = " + originatorID +
+ " , requestID = " + requestID +
+ " , subRequestID = " + subRequestID;
+ }
+ @Override
+ public boolean equals(Object obj){
+ if(obj ==null){
+ return false;
+ }
+ if(!(obj instanceof UniqueRequestIdentifier)){
+ return false;
+ }
+ UniqueRequestIdentifier identifier = (UniqueRequestIdentifier)obj;
+ if(this.originatorID == null){
+ if(identifier.originatorID !=null)
+ return false;
+ }
+ else if(!this.originatorID.equals(identifier.originatorID))
+ return false;
+
+ if(this.requestID == null){
+ if(identifier.requestID !=null)
+ return false;
+ }
+ else if(!this.requestID.equals(identifier.requestID))
+ return false;
+
+ if(this.subRequestID == null){
+ if(identifier.subRequestID !=null)
+ return false;
+ }
+ else if(!this.subRequestID.equals(identifier.subRequestID))
+ return false;
+
+ return true;
+ }
+ @Override
+ public int hashCode(){
+ final int prime = 31;
+ int result = 1;
+ result = result * prime + (this.originatorID == null ? 0 :this.originatorID.hashCode());
+ result = result * prime + (this.requestID == null ? 0 :this.requestID.hashCode());
+ result = result * prime + (this.subRequestID == null ? 0 :this.subRequestID.hashCode());
+ return result;
+ }
+
+
+}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/.gitignore b/appc-dispatcher/appc-command-executor/appc-command-executor-core/.gitignore
new file mode 100644
index 000000000..b83d22266
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/.settings/org.eclipse.wst.common.project.facet.core.xml b/appc-dispatcher/appc-command-executor/appc-command-executor-core/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644
index 000000000..f4ef8aa0a
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <installed facet="java" version="1.8"/>
+</faceted-project>
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/pom.xml b/appc-dispatcher/appc-command-executor/appc-command-executor-core/pom.xml
new file mode 100644
index 000000000..942bf7dd0
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/pom.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-command-executor</artifactId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>appc-command-executor-core</artifactId>
+ <packaging>bundle</packaging>
+
+ <name>appc-command-executor-core Bundle</name>
+ <description>appc-command-executor-core OSGi bundle project.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-command-executor-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-workflow-management-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-request-handler-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>execution-queue-management-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-data-access-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-dmaap-adapter-bundle</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-lifecycle-management-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.adaptors</groupId>
+ <artifactId>aai-service-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>domain-model-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Version>${project.version}</Bundle-Version>
+ <Embed-Dependency>appc-common,eelf-core,logback-core,logback-classic;scope=compile|runtime;inline=false</Embed-Dependency>
+ <Embed-Transitive>true</Embed-Transitive>
+ <Export-Service>org.openecomp.appc.executor.CommandExecutor</Export-Service>
+ <Import-Package>org.openecomp.appc.executionqueue.*,org.openecomp.appc.executor,org.openecomp.appc.executor.objects,!groovy.lang,!javax.jms,!org.apache.log,!org.apache.log4j.*,!org.codehaus.jackson.*,!org.codehaus.jackson.map.*,!org.codehaus.commons.compiler,!org.codehaus.groovy.*,!org.codehaus.janino,!org.jasypt.*,!com.ibm.icu.*,!com.sun.faces.*,*</Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandExecutorImpl.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandExecutorImpl.java
new file mode 100644
index 000000000..60a951722
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandExecutorImpl.java
@@ -0,0 +1,153 @@
+/*-
+ * ============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.executor.impl;
+
+
+import java.util.Date;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.commons.lang.ObjectUtils;
+import org.openecomp.appc.exceptions.APPCException;
+import org.openecomp.appc.executionqueue.ExecutionQueueService;
+import org.openecomp.appc.executionqueue.impl.ExecutionQueueServiceFactory;
+import org.openecomp.appc.executor.CommandExecutor;
+import org.openecomp.appc.executor.impl.objects.CommandRequest;
+import org.openecomp.appc.executor.impl.objects.LCMCommandRequest;
+import org.openecomp.appc.executor.impl.objects.LCMReadOnlyCommandRequest;
+import org.openecomp.appc.executor.objects.CommandExecutorInput;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+
+public class CommandExecutorImpl implements CommandExecutor {
+
+ private CommandTaskFactory executionTaskFactory ;
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(CommandExecutorImpl.class);
+
+ private ExecutionQueueService executionQueueService;
+ private ExpiredMessageHandler expiredMessageHandler;
+
+ public CommandExecutorImpl(){
+
+ }
+
+ public void setExecutionQueueService(ExecutionQueueService executionQueueService) {
+ this.executionQueueService = executionQueueService;
+ }
+
+ public void setExpiredMessageHandler(ExpiredMessageHandler expiredMessageHandler) {
+ this.expiredMessageHandler = expiredMessageHandler;
+ }
+
+ public void initialize() {
+ logger.info("initialization started of CommandExecutorImpl");
+ executionQueueService = ExecutionQueueServiceFactory.getExecutionQueueService();
+ executionQueueService.registerMessageExpirationListener(expiredMessageHandler);
+ }
+
+ public void setExecutionTaskFactory(CommandTaskFactory executionTaskFactory) {
+ this.executionTaskFactory = executionTaskFactory;
+ }
+
+ /**
+ * Execute given command
+ * Create command request and enqueue it for execution.
+ * @param commandExecutorInput Contains CommandHeader, command , target Id , payload and conf ID (optional)
+ * @throws APPCException in case of error.
+ */
+ @Override
+ public void executeCommand (CommandExecutorInput commandExecutorInput) throws APPCException{
+ if (logger.isTraceEnabled()) {
+ logger.trace("Entering to executeCommand with CommandExecutorInput = "+ ObjectUtils.toString(commandExecutorInput));
+ }
+ CommandRequest request = getCommandRequest(commandExecutorInput);
+ enqueRequest(request);
+ if (logger.isTraceEnabled()) {
+ logger.trace("Exiting from executeCommand");
+ }
+ }
+
+ private CommandRequest getCommandRequest(CommandExecutorInput commandExecutorInput){
+ if (logger.isTraceEnabled()) {
+ logger.trace("Entering to getCommandRequest with CommandExecutorInput = "+ ObjectUtils.toString(commandExecutorInput));
+ }
+ CommandRequest commandRequest;
+
+ switch(commandExecutorInput.getRuntimeContext().getRequestContext().getAction()){
+ case Sync:
+ commandRequest = new LCMReadOnlyCommandRequest(commandExecutorInput);
+ break;
+ case Audit:
+ commandRequest = new LCMReadOnlyCommandRequest(commandExecutorInput);
+ break;
+ default:
+ commandRequest = new LCMCommandRequest(commandExecutorInput);
+ break;
+ }
+ if (logger.isTraceEnabled()) {
+ logger.trace("Exiting from getCommandRequest with (CommandRequest = "+ ObjectUtils.toString(commandRequest)+")");
+ }
+ return commandRequest;
+ }
+
+ @SuppressWarnings("unchecked")
+ private void enqueRequest(CommandRequest request) throws APPCException{
+ if (logger.isTraceEnabled()) {
+ logger.trace("Entering to enqueRequest with CommandRequest = "+ ObjectUtils.toString(request));
+ }
+ try {
+ CommandTask commandTask = getMessageExecutor(request.getCommandExecutorInput().getRuntimeContext().getRequestContext().getAction().name());
+ commandTask.setCommandRequest(request);
+ long remainingTTL = getRemainingTTL(request);
+ executionQueueService.putMessage(commandTask,remainingTTL, TimeUnit.MILLISECONDS);
+ } catch (Exception e) {
+ logger.error("Exception: "+e.getMessage());
+ throw new APPCException(e);
+ }
+
+ if (logger.isTraceEnabled()) {
+ logger.trace("Exiting from enqueRequest");
+ }
+ }
+
+ private long getRemainingTTL(CommandRequest request) {
+ Date requestTimestamp = request.getCommandExecutorInput().getRuntimeContext().getRequestContext().getCommonHeader().getTimeStamp();
+ int ttl = request.getCommandExecutorInput().getRuntimeContext().getRequestContext().getCommonHeader().getFlags().getTtl();
+ return ttl*1000 + requestTimestamp.getTime() - System.currentTimeMillis();
+ }
+
+ private CommandTask getMessageExecutor(String action){
+ if (logger.isTraceEnabled()) {
+ logger.trace("Entering to getMessageExecutor with command = "+ action);
+ }
+ CommandTask executionTask = executionTaskFactory.getExecutionTask(action);
+ if (logger.isTraceEnabled()) {
+ logger.trace("Exiting from getMessageExecutor");
+ }
+ return executionTask;
+ }
+
+
+}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandTask.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandTask.java
new file mode 100644
index 000000000..6418002c2
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandTask.java
@@ -0,0 +1,126 @@
+/*-
+ * ============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.executor.impl;
+
+import static com.att.eelf.configuration.Configuration.MDC_ALERT_SEVERITY;
+import static com.att.eelf.configuration.Configuration.MDC_INSTANCE_UUID;
+import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
+import static com.att.eelf.configuration.Configuration.MDC_SERVER_FQDN;
+import static com.att.eelf.configuration.Configuration.MDC_SERVER_IP_ADDRESS;
+import static com.att.eelf.configuration.Configuration.MDC_SERVICE_INSTANCE_ID;
+import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME;
+
+import java.net.InetAddress;
+
+import org.openecomp.appc.domainmodel.lcm.RuntimeContext;
+import org.openecomp.appc.domainmodel.lcm.Status;
+import org.openecomp.appc.executor.impl.objects.CommandRequest;
+import org.openecomp.appc.executor.objects.CommandResponse;
+import org.openecomp.appc.executor.objects.LCMCommandStatus;
+import org.openecomp.appc.executor.objects.Params;
+import org.openecomp.appc.logging.LoggingConstants;
+import org.openecomp.appc.requesthandler.RequestHandler;
+import org.openecomp.appc.workflow.WorkFlowManager;
+import org.openecomp.appc.workflow.objects.WorkflowRequest;
+import org.openecomp.appc.workflow.objects.WorkflowResponse;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.slf4j.MDC;
+
+/**
+ * This abstract class is base class for all Command tasks. All command task must inherit this class.
+ */
+
+public abstract class CommandTask<M> implements Runnable {
+
+ protected RequestHandler requestHandler;
+ protected WorkFlowManager workflowManager;
+
+ private CommandRequest commandRequest;
+
+ public CommandRequest getCommandRequest() {
+ return commandRequest;
+ }
+
+ public void setCommandRequest(CommandRequest commandRequest) {
+ this.commandRequest = commandRequest;
+ }
+
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(CommandTask.class);
+
+ public void setWorkflowManager(WorkFlowManager workflowManager) {
+ this.workflowManager = workflowManager;
+ }
+
+ public void setRequestHandler(RequestHandler requestHandler) {
+ this.requestHandler = requestHandler;
+ }
+
+ CommandTask(){
+ }
+
+ public void onRequestCompletion(CommandRequest request, CommandResponse response , boolean isAAIUpdated) {
+ logger.debug("Entry: onRequestCompletion()");
+ requestHandler.onRequestExecutionEnd(request.getCommandExecutorInput().getRuntimeContext(), isAAIUpdated);
+ }
+
+ public abstract void onRequestCompletion(CommandRequest request, CommandResponse response);
+
+ protected CommandResponse buildCommandResponse(CommandRequest request, WorkflowResponse response) {
+
+ CommandResponse commandResponse = new CommandResponse();
+ commandResponse.setRuntimeContext(request.getCommandExecutorInput().getRuntimeContext());
+ return commandResponse;
+ }
+
+
+ public void execute() {
+ final RuntimeContext runtimeContext = commandRequest.getCommandExecutorInput().getRuntimeContext();
+ MDC.put(MDC_KEY_REQUEST_ID, runtimeContext.getRequestContext().getCommonHeader().getRequestId());
+ if (runtimeContext.getRequestContext().getActionIdentifiers().getServiceInstanceId() != null)
+ MDC.put(MDC_SERVICE_INSTANCE_ID, runtimeContext.getRequestContext().getActionIdentifiers().getServiceInstanceId());
+ MDC.put(LoggingConstants.MDCKeys.PARTNER_NAME, runtimeContext.getRequestContext().getCommonHeader().getOriginatorId());
+ MDC.put(MDC_SERVICE_NAME, runtimeContext.getRequestContext().getAction().name());
+ try {
+ MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getCanonicalHostName()); //Don't change it to a .getLocalHostName() again please. It's wrong!
+ MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress());
+ }catch(Exception e){
+ logger.debug(e.getMessage());
+ }
+ MDC.put(MDC_INSTANCE_UUID, ""); //TODO make instanse_UUID generation once during APPC-instanse deploying
+
+ WorkflowRequest workflowRequest = new WorkflowRequest();
+ workflowRequest.setRequestContext(runtimeContext.getRequestContext());
+ workflowRequest.setResponseContext(runtimeContext.getResponseContext());
+ workflowRequest.setVnfContext(runtimeContext.getVnfContext());
+
+ WorkflowResponse response = workflowManager.executeWorkflow(workflowRequest);
+
+ CommandResponse commandResponse = buildCommandResponse(commandRequest, response);
+ this.onRequestCompletion(commandRequest,commandResponse);
+ }
+
+ public static void fillStatus(Status status, LCMCommandStatus lcmCommandStatus, Params params) {
+ status.setCode(lcmCommandStatus.getResponseCode());
+ status.setMessage(lcmCommandStatus.getFormattedMessage(params));
+ }
+}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandTaskFactory.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandTaskFactory.java
new file mode 100644
index 000000000..610f0bca3
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandTaskFactory.java
@@ -0,0 +1,65 @@
+/*-
+ * ============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.executor.impl;
+
+
+import org.openecomp.appc.domainmodel.lcm.VNFOperation;
+import org.openecomp.appc.lifecyclemanager.LifecycleManager;
+import org.openecomp.appc.requesthandler.RequestHandler;
+import org.openecomp.appc.workflow.WorkFlowManager;
+
+
+
+
+public class CommandTaskFactory {
+
+// private LCMCommandTask lcmCommandTask;
+// private LCMReadonlyCommandTask LCMReadonlyCommandTask;
+
+ private RequestHandler requestHandler;
+ private WorkFlowManager workflowManager;
+ private LifecycleManager lifecyclemanager;
+
+
+ public void setWorkflowManager(WorkFlowManager workflowManager) {
+ this.workflowManager = workflowManager;
+ }
+
+ public void setRequestHandler(RequestHandler requestHandler) {
+ this.requestHandler = requestHandler;
+ }
+
+ public void setLifecyclemanager(LifecycleManager lifecyclemanager) {
+ this.lifecyclemanager = lifecyclemanager;
+ }
+
+
+ public synchronized CommandTask getExecutionTask(String action){
+ if (VNFOperation.Sync.toString().equals(action) || VNFOperation.Audit.toString().equals(action)){
+ return new LCMReadonlyCommandTask(requestHandler,workflowManager);
+ }else {
+ return new LCMCommandTask(requestHandler,workflowManager,
+ lifecyclemanager);
+ }
+ }
+
+}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommonMethods.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommonMethods.java
new file mode 100644
index 000000000..6ecf76c3a
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommonMethods.java
@@ -0,0 +1,72 @@
+/*-
+ * ============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.executor.impl;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.HashMap;
+
+
+class CommonMethods {
+
+ private static final HashMap m = new HashMap();
+
+ static {
+ m.put(34, "&quot;"); // < - less-than
+ m.put(60, "&lt;"); // < - less-than
+ m.put(62, "&gt;"); // > - greater-than
+ m.put(38, "&amp;"); // & - Ampersand
+ }
+
+ static String escapeHtml(String source) {
+ try {
+ StringWriter writer = new StringWriter((int) (source.length() * 1.5));
+ escape(writer, source);
+ return writer.toString();
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ return null;
+ }
+ }
+
+ private static void escape(Writer writer, String str) throws IOException {
+ int len = str.length();
+ for (int i = 0; i < len; i++) {
+ char c = str.charAt(i);
+ int ascii = (int) c;
+ String entityName = (String) m.get(ascii);
+ if (entityName == null) {
+ if (c > 0x7F) {
+ writer.write("&#");
+ writer.write(Integer.toString(c, 10));
+ writer.write(';');
+ } else {
+ writer.write(c);
+ }
+ } else {
+ writer.write(entityName);
+ }
+ }
+ }
+
+}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/ExpiredMessageHandler.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/ExpiredMessageHandler.java
new file mode 100644
index 000000000..fc79c461f
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/ExpiredMessageHandler.java
@@ -0,0 +1,45 @@
+/*-
+ * ============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.executor.impl;
+
+import org.openecomp.appc.executionqueue.MessageExpirationListener;
+import org.openecomp.appc.executor.impl.objects.CommandRequest;
+import org.openecomp.appc.requesthandler.RequestHandler;
+
+
+public class ExpiredMessageHandler<M> implements MessageExpirationListener<M>{
+ private RequestHandler requestHandler;
+
+ public ExpiredMessageHandler(){
+
+ }
+
+ public void setRequestHandler(RequestHandler requestHandler) {
+ this.requestHandler = requestHandler;
+ }
+
+ @Override
+ public void onMessageExpiration(M message) {
+ CommandRequest commandRequest = (CommandRequest)message;
+ requestHandler.onRequestTTLEnd(commandRequest.getCommandExecutorInput().getRuntimeContext(), true);
+ }
+}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMCommandTask.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMCommandTask.java
new file mode 100644
index 000000000..6e64a546b
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMCommandTask.java
@@ -0,0 +1,261 @@
+/*-
+ * ============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.executor.impl;
+
+
+import org.apache.commons.lang3.StringUtils;
+import org.openecomp.appc.domainmodel.lcm.CommonHeader;
+import org.openecomp.appc.domainmodel.lcm.Status;
+import org.openecomp.appc.domainmodel.lcm.VNFOperation;
+import org.openecomp.appc.executor.UnstableVNFException;
+import org.openecomp.appc.executor.impl.objects.CommandRequest;
+import org.openecomp.appc.executor.impl.objects.LCMCommandRequest;
+import org.openecomp.appc.executor.objects.CommandResponse;
+import org.openecomp.appc.executor.objects.LCMCommandStatus;
+import org.openecomp.appc.executor.objects.Params;
+import org.openecomp.appc.executor.objects.UniqueRequestIdentifier;
+import org.openecomp.appc.lifecyclemanager.LifecycleManager;
+import org.openecomp.appc.lifecyclemanager.objects.LifecycleException;
+import org.openecomp.appc.lifecyclemanager.objects.NoTransitionDefinedException;
+import org.openecomp.appc.lifecyclemanager.objects.VNFOperationOutcome;
+import org.openecomp.appc.requesthandler.RequestHandler;
+import org.openecomp.appc.workflow.WorkFlowManager;
+import org.openecomp.appc.workflow.objects.WorkflowResponse;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.openecomp.sdnc.sli.SvcLogicContext;
+import org.openecomp.sdnc.sli.SvcLogicException;
+import org.openecomp.sdnc.sli.SvcLogicResource;
+import org.openecomp.sdnc.sli.aai.AAIService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+public class LCMCommandTask extends CommandTask<LCMCommandRequest> {
+
+ private AAIService aaiService;
+ private LifecycleManager lifecyclemanager;
+
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(LCMCommandTask.class);
+
+ public LCMCommandTask(RequestHandler requestHandler, WorkFlowManager workflowManager,
+ LifecycleManager lifecyclemanager){
+ setRequestHandler(requestHandler);
+ setWorkflowManager(workflowManager);
+ setLifecyclemanager(lifecyclemanager);
+ getAAIservice();
+ }
+
+ public void setLifecyclemanager(LifecycleManager lifecyclemanager) {
+ this.lifecyclemanager = lifecyclemanager;
+ }
+
+
+ private void getAAIservice() {
+ BundleContext bctx = FrameworkUtil.getBundle(AAIService.class).getBundleContext();
+ // Get AAIadapter reference
+ ServiceReference sref = bctx.getServiceReference(AAIService.class.getName());
+ if (sref != null) {
+ logger.info("AAIService from bundlecontext");
+ aaiService = (AAIService) bctx.getService(sref);
+
+ } else {
+ logger.info("AAIService error from bundlecontext");
+ logger.warn("Cannot find service reference for org.openecomp.sdnc.sli.aai.AAIService");
+
+ }
+ }
+
+
+ @Override
+ public void onRequestCompletion(CommandRequest request, CommandResponse response) {
+
+ boolean isAAIUpdated = false;
+ try {
+
+ final int statusCode = request.getCommandExecutorInput().getRuntimeContext().getResponseContext().getStatus().getCode();
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Workflow Execution Status = "+ statusCode);
+ }
+
+ boolean isSuccess = statusCode == 100 || statusCode == 400;
+
+ if (isSuccess && VNFOperation.Terminate == request.getCommandExecutorInput().getRuntimeContext().getRequestContext().getAction()) {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx = getVnfdata(request.getCommandExecutorInput().getRuntimeContext().getVnfContext().getId(), "vnf", ctx);
+ isAAIUpdated = aaiService.deleteGenericVnfData(request.getCommandExecutorInput().getRuntimeContext().getVnfContext().getId(), ctx.getAttribute("vnf.resource-version"));
+ }
+ else{
+ isAAIUpdated = updateAAI(request.getCommandExecutorInput().getRuntimeContext().getVnfContext().getId() , false, isSuccess);
+ }
+ logger.debug("isAAIUpdated = " + isAAIUpdated);
+ }
+ catch(Exception e1) {
+ logger.error("Exception = " + e1);
+ throw new RuntimeException(e1);
+ }
+ finally {
+ super.onRequestCompletion(request, response , isAAIUpdated);
+ }
+ }
+
+ @Override
+ public void run() {
+ LCMCommandRequest request = (LCMCommandRequest)getCommandRequest();
+ boolean isAAIUpdated;
+ final String vnfId = request.getCommandExecutorInput().getRuntimeContext().getVnfContext().getId();
+ final String vnfType = request.getCommandExecutorInput().getRuntimeContext().getVnfContext().getType();
+ try {
+ final CommonHeader commonHeader = request.getCommandExecutorInput().getRuntimeContext().getRequestContext().getCommonHeader();
+ final boolean forceFlag = commonHeader.getFlags().isForce();
+ UniqueRequestIdentifier requestIdentifier = new UniqueRequestIdentifier(commonHeader.getOriginatorId(),
+ commonHeader.getRequestId(), commonHeader.getSubRequestId());
+ String requestIdentifierString = requestIdentifier.toIdentifierString();
+ requestHandler.onRequestExecutionStart(vnfId,false, requestIdentifierString, forceFlag);
+
+ final String currentStatus = request.getCommandExecutorInput().getRuntimeContext().getVnfContext().getStatus();
+ final VNFOperation action = request.getCommandExecutorInput().getRuntimeContext().getRequestContext().getAction();
+
+ final String nextState = lifecyclemanager.getNextState(vnfType, currentStatus, action.name());
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx=getVnfdata(vnfId, "onRequestExecutionStart", ctx);
+ isAAIUpdated= postVnfdata(vnfId, nextState,"onRequestExecutionStart",ctx);
+ } catch (NoTransitionDefinedException e) {
+ logger.error("Error getting Next State for AAI Update: " + e.getMessage(), e);
+ Status status = request.getCommandExecutorInput().getRuntimeContext().getResponseContext().getStatus();
+ Params params = new Params().addParam("actionName",e.event).addParam("currentState",e.currentState);
+ fillStatus(status, LCMCommandStatus.NO_TRANSITION_DEFINE_FAILURE, params);
+ isAAIUpdated = false;
+ } catch (UnstableVNFException e) {
+ logger.error(e.getMessage(), e);
+ Status status = request.getCommandExecutorInput().getRuntimeContext().getResponseContext().getStatus();
+ Params params = new Params().addParam("vnfId",vnfId);
+ fillStatus(status, LCMCommandStatus.UNSTABLE_VNF_FAILURE, params);
+ isAAIUpdated = false;
+ }catch (Exception e) {
+ logger.error("Error before Request Execution starts.", e);
+ Status status = request.getCommandExecutorInput().getRuntimeContext().getResponseContext().getStatus();
+ String errorMsg = StringUtils.isEmpty(e.getMessage()) ? e.toString() : e.getMessage();
+ Params params = new Params().addParam("errorMsg",errorMsg);
+ fillStatus(status, LCMCommandStatus.UNEXPECTED_FAILURE, params);
+ isAAIUpdated = false;
+ }
+
+ if (isAAIUpdated){
+ super.execute();
+ }else{
+ String errorMsg = "Error updating A& AI before Workflow execution";
+ logger.error(errorMsg);
+ WorkflowResponse response = new WorkflowResponse();
+ response.setResponseContext(request.getCommandExecutorInput().getRuntimeContext().getResponseContext());
+ CommandResponse commandResponse = super.buildCommandResponse(request, response);
+ this.onRequestCompletion(request,commandResponse);
+ }
+ }
+
+
+
+ private boolean updateAAI(String vnf_id , boolean isTTLEnd , boolean executionStatus)
+ {
+ String orchestrationStatus = null;
+ String nextState;
+ boolean callbackResponse;
+ VNFOperationOutcome outcome;
+ SvcLogicContext ctx = new SvcLogicContext();
+ try {
+ ctx=getVnfdata(vnf_id, "onRequestExecutionEnd",ctx);
+ orchestrationStatus=ctx.getAttribute("onRequestExecutionEnd.orchestration-status");
+
+ if(isTTLEnd){
+ outcome = VNFOperationOutcome.FAILURE;
+ }
+ else if(executionStatus){
+ outcome = VNFOperationOutcome.SUCCESS;
+ }
+ else{
+ outcome = VNFOperationOutcome.FAILURE;
+ }
+ nextState = lifecyclemanager.getNextState(null,orchestrationStatus, outcome.toString()) ;
+ callbackResponse= postVnfdata(vnf_id, nextState,"onRequestExecutionEnd",ctx);
+ logger.debug("AAI posting status: " + callbackResponse);
+
+ } catch (NoTransitionDefinedException e) {
+ logger.debug("Transition not defined for State = " + orchestrationStatus);
+ callbackResponse =false;
+ } catch (LifecycleException e) {
+ logger.debug("State or command not registered with State Machine. State = " + orchestrationStatus);
+ callbackResponse =false;
+ }
+ return callbackResponse;
+ }
+
+
+ private SvcLogicContext getVnfdata(String vnf_id, String prefix,SvcLogicContext ctx) {
+ String key="vnf-id = '"+ vnf_id+"'";
+ logger.debug("inside getVnfdata=== "+key);
+ try {
+ SvcLogicResource.QueryStatus response = aaiService.query("generic-vnf", false, null, key,prefix, null, ctx);
+ if(SvcLogicResource.QueryStatus.NOT_FOUND.equals(response)){
+ logger.warn("VNF " + vnf_id + " not found while updating A&AI");
+ throw new RuntimeException("VNF not found for vnf_id = "+ vnf_id);
+ }
+ else if(SvcLogicResource.QueryStatus.FAILURE.equals(response)){
+ throw new RuntimeException("Error Querying AAI with vnfID = " +vnf_id);
+ }
+ logger.info("AAIResponse: " + response.toString());
+ } catch (SvcLogicException e) {
+ logger.error("Error in getVnfdata "+ e);
+ throw new RuntimeException(e);
+ }
+ return ctx;
+ }
+
+ private boolean postVnfdata(String vnf_id, String status,String prefix,SvcLogicContext ctx) {
+ String key="vnf-id = '"+ vnf_id+"'";
+ logger.debug("inside postVnfdata=== "+key);
+ Map<String, String> data = new HashMap<>();
+ data.put("orchestration-status", status);
+ try {
+ SvcLogicResource.QueryStatus response = aaiService.update("generic-vnf", key, data, prefix, ctx);
+ if(SvcLogicResource.QueryStatus.NOT_FOUND.equals(response)){
+ logger.warn("VNF " + vnf_id + " not found while updating A&AI");
+ return false;
+ }
+ logger.info("AAIResponse: " + response.toString());
+ if(response.toString().equals("SUCCESS"))
+ {
+ return true;
+ }
+ } catch (SvcLogicException e) {
+ logger.error("Error in postVnfdata "+ e);
+ throw new RuntimeException(e);
+ }
+ return false;
+ }
+
+}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMReadonlyCommandTask.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMReadonlyCommandTask.java
new file mode 100644
index 000000000..137a2e4b5
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMReadonlyCommandTask.java
@@ -0,0 +1,81 @@
+/*-
+ * ============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.executor.impl;
+
+
+import org.apache.commons.lang3.StringUtils;
+import org.openecomp.appc.domainmodel.lcm.CommonHeader;
+import org.openecomp.appc.domainmodel.lcm.Status;
+import org.openecomp.appc.executor.UnstableVNFException;
+import org.openecomp.appc.executor.impl.objects.CommandRequest;
+import org.openecomp.appc.executor.impl.objects.LCMCommandRequest;
+import org.openecomp.appc.executor.impl.objects.LCMReadOnlyCommandRequest;
+import org.openecomp.appc.executor.objects.CommandResponse;
+import org.openecomp.appc.executor.objects.LCMCommandStatus;
+import org.openecomp.appc.executor.objects.Params;
+import org.openecomp.appc.executor.objects.UniqueRequestIdentifier;
+import org.openecomp.appc.requesthandler.RequestHandler;
+import org.openecomp.appc.workflow.WorkFlowManager;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+public class LCMReadonlyCommandTask extends CommandTask<LCMReadOnlyCommandRequest> {
+
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(LCMReadonlyCommandTask.class);
+
+ public LCMReadonlyCommandTask(RequestHandler requestHandler, WorkFlowManager workflowManager){
+
+ setRequestHandler(requestHandler);
+ setWorkflowManager(workflowManager);
+ }
+
+
+ @Override
+ public void onRequestCompletion(CommandRequest request, CommandResponse response) {
+ super.onRequestCompletion(request, response, true);
+ }
+
+ @Override
+ public void run() {
+ LCMReadOnlyCommandRequest request = (LCMReadOnlyCommandRequest)getCommandRequest();
+ final CommonHeader commonHeader = request.getCommandExecutorInput().getRuntimeContext().getRequestContext().getCommonHeader();
+ final boolean forceFlag = commonHeader.getFlags().isForce();
+ UniqueRequestIdentifier requestIdentifier = new UniqueRequestIdentifier(commonHeader.getOriginatorId(), commonHeader.getRequestId(), commonHeader.getSubRequestId());
+ String requestIdentifierString = requestIdentifier.toIdentifierString();
+ final String vnfId = request.getCommandExecutorInput().getRuntimeContext().getVnfContext().getId();
+ try {
+ requestHandler.onRequestExecutionStart(vnfId,true, requestIdentifierString, forceFlag);
+ super.execute();
+ } catch (UnstableVNFException e) {
+ logger.error(e.getMessage(), e);
+ Status status = request.getCommandExecutorInput().getRuntimeContext().getResponseContext().getStatus();
+ Params params = new Params().addParam("vnfId",vnfId);
+ fillStatus(status, LCMCommandStatus.UNSTABLE_VNF_FAILURE, params);
+ }catch (Exception e) {
+ logger.error("Error during runing LCMReadonlyCommandTask.", e);
+ Status status = request.getCommandExecutorInput().getRuntimeContext().getResponseContext().getStatus();
+ String errorMsg = StringUtils.isEmpty(e.getMessage()) ? e.toString() : e.getMessage();
+ Params params = new Params().addParam("errorMsg",errorMsg);
+ fillStatus(status, LCMCommandStatus.UNEXPECTED_FAILURE, params);
+ }
+ }
+}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/objects/CommandRequest.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/objects/CommandRequest.java
new file mode 100644
index 000000000..a1384c7bb
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/objects/CommandRequest.java
@@ -0,0 +1,89 @@
+/*-
+ * ============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.executor.impl.objects;
+
+import java.util.Date;
+
+import org.openecomp.appc.executor.objects.CommandExecutorInput;
+
+@SuppressWarnings("unused")
+public class CommandRequest {
+
+
+ private CommandExecutorInput commandExecutorInput;
+ private Date commandInTimeStamp;
+
+ public CommandRequest(CommandExecutorInput commandExecutorInput) {
+ this.commandExecutorInput = commandExecutorInput;
+ }
+
+
+ public CommandExecutorInput getCommandExecutorInput() {
+ return commandExecutorInput;
+ }
+
+ public void setCommandExecutorInput(CommandExecutorInput commandExecutorInput) {
+ this.commandExecutorInput = commandExecutorInput;
+ }
+
+ public Date getCommandInTimeStamp() {
+ return commandInTimeStamp;
+ }
+
+ public void setCommandInTimeStamp(Date commandInTimeStamp) {
+ this.commandInTimeStamp = commandInTimeStamp;
+ }
+
+ // @Override
+ // public boolean isTTLExpired() {
+ // Calendar tempTimeStamp = addTTLToRequestTime();
+ // long currentTime = System.currentTimeMillis();
+ // long tempTimeStampWithTTL = tempTimeStamp.getTimeInMillis() ;
+ // return currentTime > tempTimeStampWithTTL;
+ // }
+ //
+ // @Override
+ // public int getRemainingTTL(TimeUnit timeunit) {
+ // long tempTimeStampWithTTL = addTTLToRequestTime().getTimeInMillis() ;
+ // long currentTime = System.currentTimeMillis();
+ // long remainingTTL = tempTimeStampWithTTL - currentTime;
+ // return (int)(tempTimeStampWithTTL - currentTime);
+ // }
+ // private Calendar addTTLToRequestTime()
+ // {
+ // Date timeInRequest = this.getCommandInTimeStamp();
+ // int ttlValue = this.getCommandContext().getTtl();
+ // Calendar tempTimeStamp = Calendar.getInstance();
+ // tempTimeStamp.setTime(timeInRequest);
+ // tempTimeStamp.add(Calendar.SECOND, ttlValue);
+ // return tempTimeStamp;
+ // }
+
+
+ @Override
+ public String toString() {
+ return "CommandRequest{" +
+ "commandExecutorInput=" + commandExecutorInput +
+ ", commandInTimeStamp=" + commandInTimeStamp +
+ '}';
+ }
+}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/objects/LCMCommandRequest.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/objects/LCMCommandRequest.java
new file mode 100644
index 000000000..45111d6c1
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/objects/LCMCommandRequest.java
@@ -0,0 +1,32 @@
+/*-
+ * ============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.executor.impl.objects;
+
+import org.openecomp.appc.executor.objects.CommandExecutorInput;
+
+
+public class LCMCommandRequest extends CommandRequest {
+
+ public LCMCommandRequest(CommandExecutorInput commandExecutorInput) {
+ super(commandExecutorInput);
+ }
+}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/objects/LCMReadOnlyCommandRequest.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/objects/LCMReadOnlyCommandRequest.java
new file mode 100644
index 000000000..4d76973e2
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/objects/LCMReadOnlyCommandRequest.java
@@ -0,0 +1,33 @@
+/*-
+ * ============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.executor.impl.objects;
+
+import org.openecomp.appc.executor.objects.CommandExecutorInput;
+
+
+
+public class LCMReadOnlyCommandRequest extends CommandRequest {
+
+ public LCMReadOnlyCommandRequest(CommandExecutorInput commandExecutorInput) {
+ super(commandExecutorInput);
+ }
+}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644
index 000000000..4c5589885
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============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=========================================================
+ -->
+
+<!--
+ Starter Blueprint Camel Definition appc-command-executor-blueprint
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+ <bean id="commandExecutorBean" class="org.openecomp.appc.executor.impl.CommandExecutorImpl"
+ scope="singleton" init-method="initialize">
+ <property name="executionTaskFactory" ref="CommandExecutionTaskFactory"/>
+ <property name="expiredMessageHandler" ref="expiredMessageHandlerBean"/>
+ </bean>
+
+ <bean id="CommandExecutionTaskFactory" class="org.openecomp.appc.executor.impl.CommandTaskFactory" scope="singleton" >
+ <property name="requestHandler" ref="RequestHandlerRef" />
+ <property name="workflowManager" ref="WorkFlowManagerRef" />
+ <property name="lifecyclemanager" ref="LifecyclemanagerRef" />
+ </bean>
+
+ <bean id="expiredMessageHandlerBean" class="org.openecomp.appc.executor.impl.ExpiredMessageHandler"
+ scope="singleton">
+ <property name="requestHandler" ref="RequestHandlerRef" />
+ </bean>
+
+ <reference id="WorkFlowManagerRef" availability="mandatory" activation="eager" interface="org.openecomp.appc.workflow.WorkFlowManager" />
+ <reference id="RequestHandlerRef" availability="optional" activation="eager" interface="org.openecomp.appc.requesthandler.RequestHandler" />
+ <reference id="LifecyclemanagerRef" availability="mandatory" activation="eager" interface="org.openecomp.appc.lifecyclemanager.LifecycleManager" />
+
+ <service id="commandExecutorService" interface="org.openecomp.appc.executor.CommandExecutor" ref="commandExecutorBean"/>
+</blueprint>
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/resources/org/openecomp/appc/default.properties b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/resources/org/openecomp/appc/default.properties
new file mode 100644
index 000000000..2e5f26a0f
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/resources/org/openecomp/appc/default.properties
@@ -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=========================================================
+###
+
+# Define the name and path of any user-provided configuration (bootstrap) file that can be loaded
+# to supply configuration options
+org.openecomp.appc.bootstrap.file=appc.properties
+org.openecomp.appc.bootstrap.path=/opt/openecomp/appc/data/properties,${user.home},.
+
+
+#Property below provided by appc.properties
+#dmaap.poolMembers=<DMAAP_IP>:3904
+
+dmaap.topic.read=APPC-TEST2
+dmaap.topic.write=APPC-TEST2
+dmaap.topic.read.filter={"class": "And","filters": [{"class": "Assigned","field": "request"},{"class": "Unassigned","field": "response"}]}
+dmaap.client.name=APPC-TEST-CLIENT-CMD-EXECUTOR-MAIN
+dmaap.client.name.id=0
+#dmaap.client.key=random
+#dmaap.client.secret=random
+
+dmaap.threads.queuesize.min=1
+dmaap.threads.queuesize.max=1000
+dmaap.threads.poolsize.min=2
+dmaap.threads.poolsize.max=2
+
+#
+# This needs to be changed so that the action can be appended to the end of the URL path
+#
+#provider.urls.topology=https://admin:password@<IP_ADDRESS>:8443/restconf/operations/appc-provider:topology-service
+#provider.urls.topology=https://admin:password@<IP_ADDRESS>:8443/restconf/operations/appc-provider:
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutionTask.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutionTask.java
new file mode 100644
index 000000000..0504c3998
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutionTask.java
@@ -0,0 +1,312 @@
+/*-
+ * ============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.executor;
+/**
+ *
+ */
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+import org.openecomp.appc.domainmodel.lcm.*;
+import org.openecomp.appc.executor.impl.CommandTask;
+import org.openecomp.appc.executor.impl.CommandTaskFactory;
+import org.openecomp.appc.executor.impl.LCMCommandTask;
+import org.openecomp.appc.executor.impl.LCMReadonlyCommandTask;
+import org.openecomp.appc.executor.impl.objects.CommandRequest;
+import org.openecomp.appc.executor.impl.objects.LCMCommandRequest;
+import org.openecomp.appc.executor.impl.objects.LCMReadOnlyCommandRequest;
+import org.openecomp.appc.executor.objects.*;
+import org.openecomp.appc.lifecyclemanager.LifecycleManager;
+import org.openecomp.appc.requesthandler.RequestHandler;
+import org.openecomp.appc.workflow.WorkFlowManager;
+import org.openecomp.appc.workflow.objects.WorkflowRequest;
+import org.openecomp.appc.workflow.objects.WorkflowResponse;
+import org.openecomp.sdnc.sli.SvcLogicContext;
+import org.openecomp.sdnc.sli.SvcLogicException;
+import org.openecomp.sdnc.sli.SvcLogicResource;
+import org.openecomp.sdnc.sli.aai.AAIService;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import static junit.framework.Assert.assertEquals;
+import static org.mockito.Matchers.*;
+
+
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest( {FrameworkUtil.class, CommandTask.class, LCMCommandTask.class})
+public class TestCommandExecutionTask {
+
+ private static final String TTL_FLAG= "TTL";
+ private static final String API_VERSION= "2.0.0";
+ private static final String ORIGINATOR_ID= "1";
+ private LCMCommandTask executionTask;
+ private LCMReadonlyCommandTask LCMReadonlyCommandTask;
+ private CommandTaskFactory factory ;
+
+ private RequestHandler requestHandler;
+ private WorkFlowManager workflowManager;
+ private AAIService aaiService;
+ private LifecycleManager lifecyclemanager;
+
+ private final BundleContext bundleContext=Mockito.mock(BundleContext.class);
+ private final Bundle bundleService=Mockito.mock(Bundle.class);
+ private final ServiceReference sref=Mockito.mock(ServiceReference.class);
+
+ @Before
+ public void init() throws SvcLogicException {
+
+ // ***
+ AAIService aaiService = Mockito.mock(AAIService.class);;
+ PowerMockito.mockStatic(FrameworkUtil.class);
+ PowerMockito.when(FrameworkUtil.getBundle(AAIService.class)).thenReturn(bundleService);
+ PowerMockito.when(bundleService.getBundleContext()).thenReturn(bundleContext);
+ PowerMockito.when(bundleContext.getServiceReference(AAIService.class.getName())).thenReturn(sref);
+ PowerMockito.when(bundleContext.getService(sref)).thenReturn(aaiService);
+ PowerMockito.when(aaiService.query(anyString(),anyBoolean(),anyString(),anyString(),anyString(),anyString(),(SvcLogicContext)anyObject())).thenAnswer(new Answer<SvcLogicResource.QueryStatus>() {
+ @Override
+ public SvcLogicResource.QueryStatus answer(InvocationOnMock invocation) throws Throwable {
+ Object[] args = invocation.getArguments();
+ SvcLogicContext ctx =(SvcLogicContext)args[6];
+ String prefix = (String)args[4];
+ String key = (String)args[3];
+ if(key.contains("'28'")){
+ return SvcLogicResource.QueryStatus.FAILURE ;
+ }else if ( key.contains("'8'")) {
+ return SvcLogicResource.QueryStatus.NOT_FOUND ;
+ }else {
+ ctx.setAttribute(prefix + ".vnf-type", "FIREWALL");
+ ctx.setAttribute(prefix + ".orchestration-status", "INSTANTIATED");
+ }
+ return SvcLogicResource.QueryStatus.SUCCESS ;
+ }
+ });
+ PowerMockito.when(aaiService.update(anyString(),anyString(),(Map)anyObject(),anyString(),(SvcLogicContext)anyObject())).thenReturn(SvcLogicResource.QueryStatus.SUCCESS);
+
+ requestHandler = Mockito.mock(RequestHandler.class);
+ workflowManager = Mockito.mock(WorkFlowManager.class);
+ lifecyclemanager = Mockito.mock(LifecycleManager.class );
+
+ executionTask = new LCMCommandTask(requestHandler,workflowManager,lifecyclemanager);
+ LCMReadonlyCommandTask = new LCMReadonlyCommandTask(requestHandler,workflowManager);
+ factory = new CommandTaskFactory();
+ factory.setLifecyclemanager(lifecyclemanager);
+ factory.setWorkflowManager(workflowManager);
+ factory.setRequestHandler(requestHandler);
+ Mockito.when(workflowManager.executeWorkflow((WorkflowRequest)anyObject())).thenReturn(getWorkflowResponse () );
+ }
+
+
+ @Test
+ public void testFactory(){
+ CommandTask task;
+ task = factory.getExecutionTask("Configure");
+ assertEquals(LCMCommandTask.class,task.getClass() );
+ task = factory.getExecutionTask("Sync");
+ assertEquals(LCMReadonlyCommandTask.class,task.getClass() );
+
+ }
+
+
+
+ @Test
+ public void testOnRequestCompletion(){
+ Mockito.doNothing().when(requestHandler).onRequestTTLEnd((RuntimeContext) anyObject(),anyBoolean());
+ LCMCommandRequest request = getLCMCommandRequest("FIREWALL",30,new Date(), "11" ,setTTLInFlags("30"), VNFOperation.Configure, "1", "1.0");
+ CommandResponse response = getCommandResponse(VNFOperation.Configure, true, "11", "","1");
+ executionTask.onRequestCompletion(request, response);
+ }
+
+ @Test
+ public void testRunGetConfig(){
+ LCMReadOnlyCommandRequest request = getConfigCommandRequest("FIREWALL",30,new Date(), "11" ,setTTLInFlags("30"),VNFOperation.Sync, "1", "1.0");
+ LCMReadonlyCommandTask.setCommandRequest(request);
+ LCMReadonlyCommandTask.run();
+ }
+
+ @Test
+ public void testRun(){
+ LCMCommandRequest request = getLCMCommandRequest("FIREWALL",30,new Date(), "11" ,setTTLInFlags("30"),VNFOperation.Sync, "1", "1.0");
+ executionTask.setCommandRequest(request);
+ executionTask.run();
+ }
+
+ @Test
+ public void testRunNegative(){
+ LCMCommandRequest request = getLCMCommandRequest("FIREWALL",30,new Date(), "11" ,setTTLInFlags("30"),VNFOperation.Sync, "1", "1.0");
+ executionTask.setCommandRequest(request);
+ executionTask.run();
+ }
+
+
+ CommandResponse getCommandResponse(VNFOperation action , boolean success, String responseId, String payload, String vnfId){
+ CommandResponse commandResponse = new CommandResponse();
+ RuntimeContext runtimeContext = new RuntimeContext();
+ commandResponse.setRuntimeContext(runtimeContext);
+ ResponseContext responseContext = new ResponseContext();
+ runtimeContext.setResponseContext(responseContext);
+ RequestContext requestContext = new RequestContext();
+ runtimeContext.setRequestContext(requestContext);
+ CommonHeader commonHeader = new CommonHeader();
+ requestContext.setCommonHeader(commonHeader);
+ responseContext.setCommonHeader(commonHeader);
+ Flags flags = new Flags();
+ commonHeader.setFlags(flags);
+ ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
+ requestContext.setActionIdentifiers(actionIdentifiers);
+ VNFContext vnfContext = new VNFContext();
+ runtimeContext.setVnfContext(vnfContext);
+ requestContext.setAction(action);
+ runtimeContext.setRpcName(action.name().toLowerCase());
+ commonHeader.setApiVer(API_VERSION);
+ Status status = new Status();
+ status.setCode(100);
+ responseContext.setStatus(status);
+ commonHeader.setRequestId(responseId);
+ responseContext.setPayload(payload);
+ commonHeader.setTimestamp(new Date());
+ vnfContext.setId(vnfId);
+ return commandResponse;
+ }
+
+
+
+ @Test
+ public void testPositiveFlow_configure() {
+
+ Date timeStamp = new Date();
+ String requestId = "1";
+
+ CommandExecutorInput commandExecutorInput = pouplateCommandExecutorInput("FIREWALL",30, "1.0", timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "", VNFOperation.Configure, "33", "");
+ CommandRequest request = new CommandRequest(commandExecutorInput);
+ }
+
+
+ private Map<String,Object> setTTLInFlags( String value){
+ Map<String,Object> flags = new HashMap<String,Object>();
+ if( value != null || !("".equalsIgnoreCase(value))){
+ flags.put(TTL_FLAG, value);
+ }
+ return flags;
+ }
+
+
+ private LCMReadOnlyCommandRequest getConfigCommandRequest(String vnfType , Integer ttl , Date timeStamp, String requestId,
+ Map<String,Object> flags, VNFOperation command , String vnfId, String vnfVersion ){
+
+ CommandExecutorInput commandExecutorInput = pouplateCommandExecutorInput(vnfType, ttl, vnfVersion, timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "", command, vnfId, "");
+ LCMReadOnlyCommandRequest request = new LCMReadOnlyCommandRequest(commandExecutorInput);
+
+ return request;
+ }
+
+ private LCMCommandRequest getLCMCommandRequest(String vnfType , Integer ttl ,Date timeStamp, String requestId,
+ Map<String,Object> flags, VNFOperation command , String vnfId, String vnfVersion ){
+
+ CommandExecutorInput commandExecutorInput = pouplateCommandExecutorInput(vnfType, ttl, vnfVersion, timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "", command, vnfId, "");
+ LCMCommandRequest request = new LCMCommandRequest(commandExecutorInput);
+
+ return request;
+ }
+
+ public WorkflowResponse getWorkflowResponse (){
+ WorkflowResponse wfResponse = new WorkflowResponse();
+ ResponseContext responseContext = createResponseContextWithSuObjects();
+ wfResponse.setResponseContext(responseContext);
+ responseContext.setPayload("");
+ wfResponse.getResponseContext().getStatus().setCode(100);
+ return wfResponse;
+ }
+
+ private CommandExecutorInput pouplateCommandExecutorInput(String vnfType, int ttl, String vnfVersion, Date timeStamp, String apiVersion, String requestId, String originatorID, String subRequestID, VNFOperation action, String vnfId , String payload){
+ CommandExecutorInput commandExecutorInput = createCommandExecutorInputWithSubObjects();
+ RuntimeContext runtimeContext = commandExecutorInput.getRuntimeContext();
+ RequestContext requestContext = runtimeContext.getRequestContext();
+ ResponseContext responseContext = createResponseContextWithSuObjects();
+ runtimeContext.setResponseContext(responseContext);
+
+ requestContext.getCommonHeader().getFlags().setTtl(ttl);
+ requestContext.getCommonHeader().setApiVer(apiVersion);
+ requestContext.getCommonHeader().setTimestamp(timeStamp);
+ requestContext.getCommonHeader().setRequestId(requestId);
+ requestContext.getCommonHeader().setSubRequestId(subRequestID);
+ requestContext.getCommonHeader().setOriginatorId(originatorID);
+ requestContext.setAction(action);
+ requestContext.setPayload(payload);
+ requestContext.getActionIdentifiers().setVnfId(vnfId);
+ VNFContext vnfContext = runtimeContext.getVnfContext();
+ vnfContext.setType(vnfType);
+ vnfContext.setId(vnfId);
+ vnfContext.setVersion(vnfVersion);
+ return commandExecutorInput;
+ }
+
+ private CommandExecutorInput createCommandExecutorInputWithSubObjects() {
+ CommandExecutorInput commandExecutorInput = new CommandExecutorInput();
+ RuntimeContext runtimeContext = createRuntimeContextWithSubObjects();
+ commandExecutorInput.setRuntimeContext(runtimeContext);
+ return commandExecutorInput;
+ }
+
+ private RuntimeContext createRuntimeContextWithSubObjects() {
+ RuntimeContext runtimeContext = new RuntimeContext();
+ RequestContext requestContext = new RequestContext();
+ runtimeContext.setRequestContext(requestContext);
+ CommonHeader commonHeader = new CommonHeader();
+ requestContext.setCommonHeader(commonHeader);
+ Flags flags = new Flags();
+ commonHeader.setFlags(flags);
+ ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
+ requestContext.setActionIdentifiers(actionIdentifiers);
+ VNFContext vnfContext = new VNFContext();
+ runtimeContext.setVnfContext(vnfContext);
+ return runtimeContext;
+
+ }
+
+ private ResponseContext createResponseContextWithSuObjects(){
+ ResponseContext responseContext = new ResponseContext();
+ CommonHeader commonHeader = new CommonHeader();
+ Flags flags = new Flags();
+ Status status = new Status();
+ responseContext.setCommonHeader(commonHeader);
+ responseContext.setStatus(status);
+ commonHeader.setFlags(flags);
+ return responseContext;
+ }
+
+}
+
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutor.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutor.java
new file mode 100644
index 000000000..473e14e88
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutor.java
@@ -0,0 +1,157 @@
+/*-
+ * ============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.executor;
+/**
+ *
+ */
+
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.openecomp.appc.domainmodel.lcm.*;
+import org.openecomp.appc.exceptions.APPCException;
+import org.openecomp.appc.executionqueue.ExecutionQueueService;
+import org.openecomp.appc.executor.impl.CommandExecutorImpl;
+import org.openecomp.appc.executor.impl.CommandTaskFactory;
+import org.openecomp.appc.executor.impl.LCMCommandTask;
+import org.openecomp.appc.executor.impl.LCMReadonlyCommandTask;
+import org.openecomp.appc.executor.objects.CommandExecutorInput;
+import org.openecomp.appc.lifecyclemanager.LifecycleManager;
+import org.openecomp.appc.requesthandler.RequestHandler;
+import org.openecomp.appc.workflow.WorkFlowManager;
+
+import java.util.Date;
+import java.util.concurrent.TimeUnit;
+
+import static junit.framework.Assert.assertTrue;
+
+
+@SuppressWarnings("deprecation")
+public class TestCommandExecutor {
+
+ private static final String TTL_FLAG= "TTL";
+ private static final String API_VERSION= "2.0.0";
+ private static final String ORIGINATOR_ID= "1";
+
+ CommandExecutorImpl commandExecutor;
+
+ CommandTaskFactory executionTaskFactory;
+
+ private RequestHandler requestHandler;
+ private WorkFlowManager workflowManager;
+ private LifecycleManager lifecyclemanager;
+
+ private ExecutionQueueService executionQueueService;
+
+ @Before
+ public void init()throws Exception {
+ requestHandler= Mockito.mock(RequestHandler.class);
+ lifecyclemanager= Mockito.mock(LifecycleManager.class);
+ workflowManager= Mockito.mock(WorkFlowManager.class);
+
+ executionQueueService = Mockito.mock(ExecutionQueueService.class);
+
+ commandExecutor = new CommandExecutorImpl();
+ executionTaskFactory = Mockito.mock(CommandTaskFactory.class);
+ commandExecutor.setExecutionTaskFactory(executionTaskFactory);
+ commandExecutor.setExecutionQueueService(executionQueueService);
+ LCMCommandTask lcmCommandTask = Mockito.mock(LCMCommandTask.class);
+ LCMReadonlyCommandTask LCMReadonlyCommandTask = Mockito.mock(LCMReadonlyCommandTask.class);
+ Mockito.when(executionTaskFactory.getExecutionTask("Configure")).thenReturn(lcmCommandTask);
+ Mockito.when(executionTaskFactory.getExecutionTask("Sync")).thenReturn(LCMReadonlyCommandTask);
+// Mockito.when(executionQueueService.putMessage((Runnable) Mockito.anyObject(),Mockito.anyLong(),(TimeUnit)Mockito.anyObject())).thenReturn(true);
+
+ }
+
+
+ @Test
+ public void testPositiveFlow_LCM(){
+ //Map <String,Object> flags = setTTLInFlags("30");
+ Date timeStamp = new Date();
+ String requestId = "1";
+ CommandExecutorInput commandExecutorInput = pouplateCommandExecutorInput("FIREWALL", 30, "1.0", timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "2", VNFOperation.Configure, "15", "") ;
+ try {
+ commandExecutor.executeCommand(commandExecutorInput);
+ } catch (APPCException e) {
+ Assert.fail(e.toString());
+ }
+
+ }
+
+ @Test
+ public void testPositiveFlow_GetConfig(){
+ Date timeStamp = new Date();
+ String requestId = "1";
+
+ CommandExecutorInput commandExecutorInput = pouplateCommandExecutorInput("FIREWALL", 30, "1.0", timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "2", VNFOperation.Sync,"15","") ;
+ try {
+ commandExecutor.executeCommand(commandExecutorInput);
+ } catch (APPCException e) {
+ Assert.fail(e.toString());
+ }
+
+ }
+
+
+ private CommandExecutorInput pouplateCommandExecutorInput(String vnfType, int ttl, String vnfVersion, Date timeStamp, String apiVersion, String requestId, String originatorID, String subRequestID, VNFOperation action, String vnfId , String payload){
+ CommandExecutorInput commandExecutorInput = createCommandExecutorInputWithSubObjects();
+ RuntimeContext runtimeContext = commandExecutorInput.getRuntimeContext();
+ RequestContext requestContext = runtimeContext.getRequestContext();
+ requestContext.getCommonHeader().getFlags().setTtl(ttl);
+ requestContext.getCommonHeader().setApiVer(apiVersion);
+ requestContext.getCommonHeader().setTimestamp(timeStamp);
+ requestContext.getCommonHeader().setRequestId(requestId);
+ requestContext.getCommonHeader().setSubRequestId(subRequestID);
+ requestContext.getCommonHeader().setOriginatorId(originatorID);
+ requestContext.setAction(action);
+ requestContext.setPayload(payload);
+ requestContext.getActionIdentifiers().setVnfId(vnfId);
+ VNFContext vnfContext = runtimeContext.getVnfContext();
+ vnfContext.setType(vnfType);
+ vnfContext.setId(vnfId);
+ vnfContext.setVersion(vnfVersion);
+ return commandExecutorInput;
+ }
+
+ private CommandExecutorInput createCommandExecutorInputWithSubObjects() {
+ CommandExecutorInput commandExecutorInput = new CommandExecutorInput();
+ RuntimeContext runtimeContext = new RuntimeContext();
+ commandExecutorInput.setRuntimeContext(runtimeContext);
+ RequestContext requestContext = new RequestContext();
+ runtimeContext.setRequestContext(requestContext);
+ CommonHeader commonHeader = new CommonHeader();
+ requestContext.setCommonHeader(commonHeader);
+ Flags flags = new Flags();
+ commonHeader.setFlags(flags);
+ ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
+ requestContext.setActionIdentifiers(actionIdentifiers);
+ VNFContext vnfContext = new VNFContext();
+ runtimeContext.setVnfContext(vnfContext);
+ return commandExecutorInput;
+ }
+
+
+
+}
+
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/resources/org/openecomp/appc/default.properties b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/resources/org/openecomp/appc/default.properties
new file mode 100644
index 000000000..74552a9d7
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/resources/org/openecomp/appc/default.properties
@@ -0,0 +1,102 @@
+###
+# ============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=========================================================
+###
+
+# Define the name and path of any user-provided configuration (bootstrap) file that can be loaded to supply configuration options
+#org.openecomp.appc.bootstrap.file=executor-test.properties
+org.openecomp.appc.bootstrap.file=appc.properties
+org.openecomp.appc.bootstrap.path=/opt/openecomp/appc/data/properties,${user.home},.
+
+
+#
+# Certificate keystore and truststore
+#
+#org.openecomp.sdnc.sli.aai.ssl.trust=<jks_FILE_HERE>
+#org.openecomp.sdnc.sli.aai.ssl.trust.psswd=adminadmin
+#org.openecomp.sdnc.sli.aai.ssl.key=<p12_FILE_HERE>
+#org.openecomp.sdnc.sli.aai.ssl.key.psswd=adminadmin
+org.openecomp.sdnc.sli.aai.host.certificate.ignore=true
+org.openecomp.sdnc.sli.aai.certificate.trust.all=true
+
+
+#
+# Configuration file for A&AI Adapter
+#
+
+# OPEN SOURCE - EXTERNAL A&AI INSTANCE IN TEST ENVIRONMENT
+org.openecomp.sdnc.sli.aai.uri=https://10.0.1.1:8443
+
+org.openecomp.sdnc.sli.aai.path.query=/aai/v8/search/sdn-zone-query
+
+# service instance
+org.openecomp.sdnc.sli.aai.path.svcinst=/aai/v8/business/customers/customer/{customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances
+org.openecomp.sdnc.sli.aai.path.svcinst.query=/aai/v8/search/generic-query?key=service-instance.service-instance-id:{svc-instance-id}&start-node-type=service-instance&include=service-instance
+
+# complex
+org.openecomp.sdnc.sli.aai.path.complexes=/aai/v8/cloud-infrastructure/complexes
+org.openecomp.sdnc.sli.aai.path.complex=/aai/v8/cloud-infrastructure/complexes/complex/{physical-location-id}
+
+# vservers
+org.openecomp.sdnc.sli.aai.path.vservers=/aai/v8/cloud-infrastructure/tenants/tenant/{tenant-id}/vservers
+org.openecomp.sdnc.sli.aai.path.vserver =/aai/v8/cloud-infrastructure/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}
+
+# generic-vnf
+org.openecomp.sdnc.sli.aai.path.generic.vnfs=/aai/v8/network/generic-vnfs/generic-vnf/
+org.openecomp.sdnc.sli.aai.path.generic.vnf=/aai/v8/network/generic-vnfs/generic-vnf/{vnf-id}
+
+#
+# Formatting
+#
+org.openecomp.sdnc.sli.aai.param.format=filter=%s:%s
+org.openecomp.sdnc.sli.aai.param.vnf_type=vnf-type
+org.openecomp.sdnc.sli.aai.param.physical.location.id=physical-location-id
+org.openecomp.sdnc.sli.aai.param.service.type=service-type
+
+org.openecomp.appc.logging.path=${user.home},etc,../etc,.
+org.openecomp.appc.logging.file=logback.xml
+
+org.openecomp.appc.db.url.%s", schema), "");
+org.openecomp.appc.db.user.%s", schema), "");
+org.openecomp.appc.db.pass.%s", schema), "");
+
+
+#Property below provided by appc.properties
+#dmaap.poolMembers=<DMAAP_IP>:3904
+
+dmaap.topic.read=APPC-TEST2
+dmaap.topic.write=APPC-TEST2
+#dmaap.topic.read.filter={"class":"Assigned","field":"request"}
+dmaap.topic.read.filter={"class": "And","filters": [{"class": "Assigned","field": "request"},{"class": "Unassigned","field": "response"}]}
+dmaap.client.name=APPC-TEST-CLIENT-CMD-EXECUTOR-TEST
+dmaap.client.name.id=0
+#dmaap.client.key=random
+#dmaap.client.secret=random
+
+dmaap.threads.queuesize.min=1
+dmaap.threads.queuesize.max=1000
+dmaap.threads.poolsize.min=2
+dmaap.threads.poolsize.max=2
+
+
+#
+# This needs to be changed so that the action can be appended to the end of the URL path
+#
+#provider.urls.topology=https://admin:password@<IP_ADDRESS>:8443/restconf/operations/appc-provider:topology-service
+#provider.urls.topology=https://admin:password@<IP_ADDRESS>:8443/restconf/operations/appc-provider:
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-features/.gitignore b/appc-dispatcher/appc-command-executor/appc-command-executor-features/.gitignore
new file mode 100644
index 000000000..2992ae832
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-features/.gitignore
@@ -0,0 +1,3 @@
+/target/
+/bin/
+/.settings/
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-features/pom.xml b/appc-dispatcher/appc-command-executor/appc-command-executor-features/pom.xml
new file mode 100644
index 000000000..420c25ca4
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-features/pom.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>appc-command-executor</artifactId>
+ <groupId>org.openecomp.appc</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <name>appc-command-executor-features</name>
+ <artifactId>appc-command-executor-features</artifactId>
+
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-command-executor-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-command-executor-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <filtering>true</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>filter</id>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ <phase>generate-resources</phase>
+ </execution>
+ </executions>
+ </plugin>
+<!-- <plugin> -->
+ <!-- launches the feature test, which validates that your karaf feature
+ can be installed inside of a karaf container. It doesn't validate that your
+ functionality works correctly, just that you have all of the dependent bundles
+ defined correctly. -->
+<!-- <groupId>org.apache.maven.plugins</groupId> -->
+<!-- <artifactId>maven-surefire-plugin</artifactId> -->
+<!-- <version>2.16</version> -->
+<!-- <configuration> -->
+<!-- <systemPropertyVariables> -->
+<!-- <karaf.distro.groupId>org.opendaylight.controller</karaf.distro.groupId> -->
+<!-- <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId> -->
+<!-- <karaf.distro.version>${odl.karaf.empty.distro.version}</karaf.distro.version> -->
+<!-- </systemPropertyVariables> -->
+<!-- <dependenciesToScan> -->
+<!-- <dependency>org.opendaylight.yangtools:features-test</dependency> -->
+<!-- </dependenciesToScan> -->
+<!-- <classpathDependencyExcludes> -->
+ <!-- The dependencies which bring in AbstractDataBrokerTest class brings
+ in a second PaxExam container which results in the feature tests failing
+ with a message similar to: "ERROR o.ops4j.pax.exam.spi.PaxExamRuntime - Ambiguous
+ TestContainer ..." This excludes the container we don't want to use. -->
+<!-- <classpathDependencyExcludes>org.ops4j.pax.exam:pax-exam-container-native</classpathDependencyExcludes> -->
+<!-- </classpathDependencyExcludes> -->
+<!-- </configuration> -->
+<!-- </plugin> -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/classes/${features.file}</file>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Skipping ODL feature test -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-features/src/main/resources/features.xml b/appc-dispatcher/appc-command-executor/appc-command-executor-features/src/main/resources/features.xml
new file mode 100644
index 000000000..48846fc73
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-features/src/main/resources/features.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============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=========================================================
+ -->
+
+
+<features name="appc-command-executor-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+
+ <feature name='appc-command-executor' description="application executor" version='${project.version}'>
+ <bundle>mvn:org.openecomp.appc/execution-queue-management-lib/${project.version}</bundle>
+ <bundle>mvn:org.openecomp.appc/appc-command-executor-api/${project.version}</bundle>
+ <bundle>mvn:org.openecomp.appc/appc-command-executor-core/${project.version}</bundle>
+ <!--<bundle>mvn:org.apache.commons/commons-lang3/3.4</bundle>-->
+ </feature>
+
+</features>
diff --git a/appc-dispatcher/appc-command-executor/pom.xml b/appc-dispatcher/appc-command-executor/pom.xml
new file mode 100644
index 000000000..d028d1899
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/pom.xml
@@ -0,0 +1,22 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-dispatcher</artifactId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>appc-command-executor</artifactId>
+ <packaging>pom</packaging>
+ <name>APPC Command Executor</name>
+ <description>APPC Command Executor</description>
+
+ <!-- ================================================================================== -->
+ <!-- The modules we build -->
+ <!-- ================================================================================== -->
+ <modules>
+ <module>appc-command-executor-api</module>
+ <module>appc-command-executor-core</module>
+ <module>appc-command-executor-features</module>
+ </modules>
+
+</project> \ No newline at end of file