summaryrefslogtreecommitdiffstats
path: root/appc-dispatcher/appc-command-executor
diff options
context:
space:
mode:
authorAnand <ac204h@att.com>2018-01-04 19:35:51 -0500
committerSkip Wonnell <skip@att.com>2018-01-08 22:09:50 +0000
commit36bcd566167f2f91c0e8e7a304fce5f6bc150776 (patch)
tree7ba7acfee7e520da83a2b6286ea464285bc8cf67 /appc-dispatcher/appc-command-executor
parent38d293d605b42f88c9c82319ba848b4b81e45b64 (diff)
Include impacted changes for APPC-346,APPC-348
Issue-ID: APPC-347 Change-Id: I399bc2a1e0dfd481e103032a373bb80fce5baf41 Signed-off-by: Anand <ac204h@att.com>
Diffstat (limited to 'appc-dispatcher/appc-command-executor')
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/pom.xml100
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/CommandExecutor.java4
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/UnstableVNFException.java32
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/CommandExecutorInput.java (renamed from appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/CommandResponse.java)27
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/LCMCommandStatus.java120
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/UniqueRequestIdentifier.java126
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/pom.xml107
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommandExecutorImpl.java109
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommandTask.java161
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommandTaskFactory.java89
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommonMethods.java75
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/ExpiredMessageHandler.java63
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/LCMCommandTask.java294
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/LCMReadonlyCommandTask.java78
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/objects/CommandRequest.java (renamed from appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/conv/Converter.java)49
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml33
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/resources/org/onap/appc/default.properties4
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/onap/appc/executor/CommandExecutionTaskTest.java295
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/onap/appc/executor/TestCommandExecutor.java215
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/onap/appc/executor/TestCommandTask.java231
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/resources/org/onap/appc/default.properties1
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-features/pom.xml227
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-features/src/main/resources/features.xml9
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-installer/.gitignore2
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-installer/pom.xml137
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/assembly/assemble_installer_zip.xml60
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/assembly/assemble_mvnrepo_zip.xml51
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/main/resources/scripts/install-feature.sh63
-rw-r--r--appc-dispatcher/appc-command-executor/pom.xml32
29 files changed, 900 insertions, 1894 deletions
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
index d58c7bd6c..2dc3fdbf3 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-api/pom.xml
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/pom.xml
@@ -1,44 +1,64 @@
-<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.onap.appc</groupId>
- <artifactId>appc-command-executor</artifactId>
- <version>1.3.0-SNAPSHOT</version>
- </parent>
- <artifactId>appc-command-executor-api</artifactId>
- <packaging>bundle</packaging>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APPC
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Copyright (C) 2017 Amdocs
+ =============================================================================
+ 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
- <name>appc-command-executor-api</name>
- <url>http://maven.apache.org</url>
+ http://www.apache.org/licenses/LICENSE-2.0
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
+ 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.
- <dependencies>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>execution-queue-management-lib</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>domain-model-lib</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-common</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
- <!--<dependency>-->
- <!--<groupId>org.apache.commons</groupId>-->
- <!--<artifactId>commons-lang3</artifactId>-->
- <!--<version>3.4</version>-->
- <!--<scope>provided</scope>-->
- <!--</dependency>-->
- </dependencies>
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ ============LICENSE_END=========================================================
+ -->
+<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.onap.appc</groupId>
+ <artifactId>appc-command-executor</artifactId>
+ <version>1.3.0-SNAPSHOT</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.onap.appc</groupId>
+ <artifactId>execution-queue-management-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.appc</groupId>
+ <artifactId>domain-model-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.appc</groupId>
+ <artifactId>appc-common</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
<build>
<plugins>
<plugin>
@@ -48,7 +68,9 @@
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
- <Export-Package>org.onap.appc.executor,org.onap.appc.executor.objects,org.onap.appc.executor.conv,org.onap.appc.executor.helper</Export-Package>
+ <Export-Package>
+ org.onap.appc.executor,org.onap.appc.executor.objects,org.onap.appc.executor.conv,org.onap.appc.executor.helper
+ </Export-Package>
<Embed-Dependency>
javax.json;scope=compile|runtime;inline=false
</Embed-Dependency>
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/CommandExecutor.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/CommandExecutor.java
index d6935b83a..635c7d265 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/CommandExecutor.java
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/CommandExecutor.java
@@ -28,8 +28,8 @@
package org.onap.appc.executor;
-import org.onap.appc.domainmodel.lcm.RuntimeContext;
import org.onap.appc.exceptions.APPCException;
+import org.onap.appc.executor.objects.CommandExecutorInput;
@@ -40,5 +40,5 @@ public interface CommandExecutor {
* @param commandHeaderInput Contains CommandHeader, command , target Id , payload and conf ID (optional)
* @throws APPCException in case of error.
*/
- void executeCommand(RuntimeContext commandHeaderInput) throws APPCException;
+ void executeCommand(CommandExecutorInput commandHeaderInput) throws APPCException;
}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/UnstableVNFException.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/UnstableVNFException.java
deleted file mode 100644
index 634bd0f68..000000000
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/UnstableVNFException.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.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/onap/appc/executor/objects/CommandResponse.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/CommandExecutorInput.java
index 4e7b9b17f..7cd79ba2c 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/CommandResponse.java
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/CommandExecutorInput.java
@@ -26,17 +26,32 @@ package org.onap.appc.executor.objects;
import org.onap.appc.domainmodel.lcm.RuntimeContext;
+public class CommandExecutorInput {
+ private RuntimeContext runtimeContext ;
+ private int ttl;
-public class CommandResponse {
- private final RuntimeContext runtimeContext;
+ public RuntimeContext getRuntimeContext() {
+ return runtimeContext;
+ }
- public CommandResponse(RuntimeContext runtimeContext) {
- super();
+ public void setRuntimeContext(RuntimeContext runtimeContext) {
this.runtimeContext = runtimeContext;
}
- public RuntimeContext getRuntimeContext() {
- return 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/onap/appc/executor/objects/LCMCommandStatus.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/LCMCommandStatus.java
index 849b5b08f..b9430cc97 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/LCMCommandStatus.java
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/LCMCommandStatus.java
@@ -24,97 +24,91 @@
package org.onap.appc.executor.objects;
-
-import org.onap.appc.domainmodel.lcm.Status;
import org.onap.appc.util.MessageFormatter;
import java.util.Map;
public enum LCMCommandStatus {
- ACCEPTED(100,"ACCEPTED - request accepted"),
+ 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}"),
- INVALID_VNF_STATE(305,"Request rejected because VNF status in A&AI is - ${currentState}" ),
- 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"),
- MISSING_VNF_DATA_IN_AAI(313,"MISSING VNF DATA IN A&AI - ${attributeName} not found for VNF ID = ${vnfId}"),
-
- SUCCESS(400,"SUCCESS - request has been processed successfully"),
-
+ 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}"),
+ /*
+ * TODO: Change responseMessage from "INVALID INPUT PARAMETER" to "INVALID INPUT PARAMETER(S)" tracked ATTAPPC-4863
+ *
+ * With consideration of updating integration test case effort, "INVALID INPUT PARAMETER" is used while the task
+ * ATTAPPC-4863 is tracking the need of this change when resource is available.
+ *
+ * However, when pushing this file to ONAP, responseMessage should be changed to "INVALID INPUT PARAMETER(S)",
+ * and this comments should be removed.
+ */
+ // TODO 77777777 to support "${paramName} with invalid value ${paramValue}"
+ INVALID_INPUT_PARAMETER(301, "INVALID INPUT PARAMETER - ${errorMsg}"),
+ MISSING_MANDATORY_PARAMETER(302, "MISSING MANDATORY PARAMETER - Parameter/s ${paramName} is/are missing" ),
+ REQUEST_PARSING_FAILED(303, "REQUEST PARSING FAILED - ${errorMsg}"),
+ 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"),
+ EXPIRED_REQUEST(311, "EXPIRED REQUEST"),
+ DUPLICATE_REQUEST(312, "DUPLICATE REQUEST"),
+ MISSING_VNF_DATA_IN_AAI(313, "MISSING VNF DATA IN A&AI - ${attributeName} not found for VNF ID = ${vnfId}"),
+ VSERVER_NOT_FOUND(314, "VSERVER NOT FOUND - vserver with ID ${id} was not found"),
+ MULTIPLE_REQUESTS_FOUND(315, "MULTIPLE REQUESTS FOUND - using search criteria: ${parameters}"),
+ POLICY_VALIDATION_FAILURE(316,"POLICY VALIDATION FAILURE - ${errorMsg}"),
+ EXLCUSIVE_REQUEST_IN_PROGRESS(317,"EXCLUSIVE REQUEST IN PROGRESS - ${errorMsg}"),
+ LOCKED_VNF_ID(318,"${errorMsg}"),
+
+ SUCCESS(400, "SUCCESS - request has been processed successfully"),
+
+ //ERROR(4xx) - failure for Async response
+ DG_FAILURE(401, "DG FAILURE - ${errorMsg}"),
+ EXPIRED_REQUEST_FAILURE(404, "EXPIRED REQUEST FAILURE - failed after accepted because TTL expired");
+
+
+ //ERROR(5xx) - failure for Intermediate response
// 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;
-
-
+ 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 responseMessage;
+ }
+ public int getResponseCode() {
+ return responseCode;
+ }
- /**
- *
- * @return messageTemplate
+ /**
+ * @return messageTemplate
*/
+ public String getFormattedMessage(Params params) {
+ Map<String, Object> paramsMap = params != null ? params.getParams() : null;
+ return MessageFormatter.format(getResponseMessage(), paramsMap);
+ }
-
- 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);
+ public String getFormattedMessageWithCode(Params params) {
+ return getResponseCode() + "-" + getFormattedMessage(params);
}
@Override
public String toString() {
return "LCMCommandStatus{" +
- "responseCode=" + responseCode +
- ", responseMessage='" + responseMessage + '\'' +
- '}';
- }
-
- public Status toStatus(Params params) {
- return new Status(responseCode, getFormattedMessage(params));
+ "responseCode=" + responseCode +
+ ", responseMessage='" + responseMessage + '\'' +
+ '}';
}
}
-
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/UniqueRequestIdentifier.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/UniqueRequestIdentifier.java
deleted file mode 100644
index b2f2a1d89..000000000
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/UniqueRequestIdentifier.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.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/pom.xml b/appc-dispatcher/appc-command-executor/appc-command-executor-core/pom.xml
index a0ebe9dc0..4c4f4069c 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/pom.xml
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/pom.xml
@@ -1,65 +1,71 @@
<?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">
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APPC
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Copyright (C) 2017 Amdocs
+ =============================================================================
+ 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
- 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.
- -->
+ 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.
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ ============LICENSE_END=========================================================
+ -->
+<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.onap.appc</groupId>
- <artifactId>appc-command-executor</artifactId>
- <version>1.3.0-SNAPSHOT</version>
- </parent>
+ <parent>
+ <groupId>org.onap.appc</groupId>
+ <artifactId>appc-command-executor</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </parent>
+
<artifactId>appc-command-executor-core</artifactId>
<packaging>bundle</packaging>
-
- <name>appc-command-executor-core Bundle</name>
+ <name>APPC Command Executor - Core</name>
<description>appc-command-executor-core OSGi bundle project.</description>
<dependencies>
<dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-common</artifactId>
- <version>${project.version}</version>
+ <groupId>org.onap.appc</groupId>
+ <artifactId>appc-common</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-command-executor-api</artifactId>
+ <groupId>org.onap.appc</groupId>
+ <artifactId>appc-command-executor-api</artifactId>
</dependency>
<dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-workflow-management-api</artifactId>
- <version>${project.version}</version>
+ <groupId>org.onap.appc</groupId>
+ <artifactId>appc-workflow-management-api</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-request-handler-api</artifactId>
- <version>${project.version}</version>
+ <groupId>org.onap.appc</groupId>
+ <artifactId>appc-request-handler-api</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>execution-queue-management-lib</artifactId>
- <version>${project.version}</version>
+ <groupId>org.onap.appc</groupId>
+ <artifactId>execution-queue-management-lib</artifactId>
+ <version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-data-access-lib</artifactId>
- <version>${project.version}</version>
+ <dependency>
+ <groupId>org.onap.appc</groupId>
+ <artifactId>appc-data-access-lib</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onap.appc</groupId>
@@ -91,7 +97,8 @@
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
- <Embed-Dependency>eelf-core,logback-core,logback-classic;scope=compile|runtime;inline=false</Embed-Dependency>
+ <Embed-Dependency>eelf-core,logback-core,logback-classic;scope=compile|runtime;inline=false
+ </Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Export-Service>org.onap.appc.executor.CommandExecutor</Export-Service>
<Import-Package>
@@ -107,12 +114,12 @@
</build>
<dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-command-executor-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.appc</groupId>
+ <artifactId>appc-command-executor-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</dependencyManagement>
</project>
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommandExecutorImpl.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommandExecutorImpl.java
index d23a3fdd6..3ee89f11c 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommandExecutorImpl.java
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommandExecutorImpl.java
@@ -22,128 +22,87 @@
* ============LICENSE_END=========================================================
*/
-/**
- *
- */
package org.onap.appc.executor.impl;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import org.apache.commons.lang.ObjectUtils;
-import org.onap.appc.domainmodel.lcm.RuntimeContext;
import org.onap.appc.exceptions.APPCException;
import org.onap.appc.executionqueue.ExecutionQueueService;
import org.onap.appc.executor.CommandExecutor;
+import org.onap.appc.executor.impl.objects.CommandRequest;
+import org.onap.appc.executor.objects.CommandExecutorInput;
+import org.onap.appc.requesthandler.RequestHandler;
+import org.onap.appc.workflow.WorkFlowManager;
-import java.time.Instant;
-import java.time.temporal.ChronoUnit;
+import java.util.Date;
import java.util.concurrent.TimeUnit;
public class CommandExecutorImpl implements CommandExecutor {
- private CommandTaskFactory executionTaskFactory;
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(CommandExecutorImpl.class);
+ private final EELFLogger logger = EELFManager.getInstance().getLogger(CommandExecutorImpl.class);
private ExecutionQueueService executionQueueService;
- private ExpiredMessageHandler expiredMessageHandler;
-
- public CommandExecutorImpl() {
-
- }
+ private RequestHandler requestHandler;
+ private WorkFlowManager workflowManager;
/**
- * Injected by blueprint
- *
- * @param executionQueueService
+ * Initialization.
+ * <p>Used through blueprint.
*/
+ public void initialize() {
+ logger.info("initialization started of CommandExecutorImpl");
+ }
+
public void setExecutionQueueService(ExecutionQueueService executionQueueService) {
this.executionQueueService = executionQueueService;
}
- /**
- * Injected by blueprint
- * @param expiredMessageHandler
- */
- public void setExpiredMessageHandler(ExpiredMessageHandler expiredMessageHandler) {
- this.expiredMessageHandler = expiredMessageHandler;
+ public void setWorkflowManager(WorkFlowManager workflowManager) {
+ this.workflowManager = workflowManager;
}
- public void initialize() {
- logger.info("initialization started of CommandExecutorImpl");
- executionQueueService.registerMessageExpirationListener(expiredMessageHandler);
+ public void setRequestHandler(RequestHandler requestHandler) {
+ this.requestHandler = requestHandler;
}
- 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(RuntimeContext commandExecutorInput) throws APPCException {
- if (logger.isTraceEnabled()) {
- logger.trace("Entering to executeCommand with CommandExecutorInput = " + ObjectUtils.toString(commandExecutorInput));
- }
- enqueRequest(commandExecutorInput);
- if (logger.isTraceEnabled()) {
- logger.trace("Exiting from executeCommand");
- }
- }
-
- private RuntimeContext getCommandRequest(RuntimeContext commandExecutorInput) {
- if (logger.isTraceEnabled()) {
- logger.trace("Entering to getCommandRequest with CommandExecutorInput = " + ObjectUtils.toString(commandExecutorInput));
- }
- RuntimeContext commandRequest;
- commandRequest = commandExecutorInput;
- if (logger.isTraceEnabled()) {
- logger.trace("Exiting from getCommandRequest with (CommandRequest = " + ObjectUtils.toString(commandRequest) + ")");
- }
- return commandRequest;
- }
-
- @SuppressWarnings("unchecked")
- private void enqueRequest(RuntimeContext request) throws APPCException {
+ public void executeCommand (CommandExecutorInput commandExecutorInput) throws APPCException{
if (logger.isTraceEnabled()) {
- logger.trace("Entering to enqueRequest with CommandRequest = " + ObjectUtils.toString(request));
+ logger.trace("Entering to executeCommand with CommandExecutorInput = "+ ObjectUtils.toString(commandExecutorInput));
}
+ CommandTask commandTask;
try {
- CommandTask commandTask = executionTaskFactory.getExecutionTask(request);
-
- long remainingTTL = getRemainingTTL(request);
-
- executionQueueService.putMessage(commandTask, remainingTTL, TimeUnit.MILLISECONDS);
+ commandTask= new CommandTask(requestHandler,workflowManager);
+ commandTask.setCommandRequest(new CommandRequest(commandExecutorInput));
+ long remainingTTL = getRemainingTTL(commandTask.getCommandRequest());
+ if (logger.isTraceEnabled()) {
+ logger.trace("Queuing request with CommandRequest = "+ ObjectUtils.toString(commandTask.getCommandRequest()));
+ }
+ executionQueueService.putMessage(commandTask,remainingTTL, TimeUnit.MILLISECONDS);
} catch (Exception e) {
- logger.error("Exception: " + e.getMessage());
+ logger.error("Exception: "+e.getMessage());
throw new APPCException(e);
}
if (logger.isTraceEnabled()) {
- logger.trace("Exiting from enqueRequest");
+ logger.trace("Exiting from executeCommand");
}
}
- private long getRemainingTTL(RuntimeContext request) {
- Instant requestTimestamp = request.getRequestContext().getCommonHeader().getTimeStamp();
- int ttl = request.getRequestContext().getCommonHeader().getFlags().getTtl();
- return ChronoUnit.MILLIS.between(Instant.now(), requestTimestamp.plusSeconds(ttl));
+ 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(RuntimeContext request) {
- if (logger.isTraceEnabled()) {
- logger.trace("Entering to getMessageExecutor with command = " + request);
- }
- CommandTask executionTask = executionTaskFactory.getExecutionTask(request);
- 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/onap/appc/executor/impl/CommandTask.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommandTask.java
index ca866575a..4a82ca6a8 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommandTask.java
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommandTask.java
@@ -24,59 +24,174 @@
package org.onap.appc.executor.impl;
-import org.onap.appc.executor.objects.CommandResponse;
+import org.onap.appc.domainmodel.lcm.Status;
+import org.onap.appc.domainmodel.lcm.VNFOperation;
+import org.onap.appc.executor.impl.objects.CommandRequest;
+import org.onap.appc.logging.LoggingConstants;
import org.onap.appc.requesthandler.RequestHandler;
import org.onap.appc.domainmodel.lcm.RuntimeContext;
import org.onap.appc.workflow.WorkFlowManager;
import org.onap.appc.workflow.objects.WorkflowRequest;
-import org.onap.appc.workflow.objects.WorkflowResponse;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
+import org.onap.ccsdk.sli.adaptors.aai.AAIService;
+import org.onap.ccsdk.sli.adaptors.aai.AAIServiceException;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.MDC;
+
+import java.net.InetAddress;
+
+import static com.att.eelf.configuration.Configuration.*;
+import static com.att.eelf.configuration.Configuration.MDC_SERVICE_INSTANCE_ID;
+import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME;
/**
* This abstract class is base class for all Command tasks. All command task must inherit this class.
*/
-public abstract class CommandTask implements Runnable {
+public class CommandTask implements Runnable {
- protected final RequestHandler requestHandler;
- protected final WorkFlowManager workflowManager;
- protected final RuntimeContext commandRequest;
+ private RequestHandler requestHandler;
+ private WorkFlowManager workflowManager;
+ private CommandRequest commandRequest;
+ private AAIService aaiService;
- protected CommandTask(RuntimeContext commandRequest, RequestHandler requestHandler,
- WorkFlowManager workflowManager) {
- super();
+
+ public CommandRequest getCommandRequest() {
+ return commandRequest;
+ }
+
+ public void setCommandRequest(CommandRequest commandRequest) {
this.commandRequest = commandRequest;
- this.requestHandler = requestHandler;
- this.workflowManager = workflowManager;
}
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(CommandTask.class);
+ private final EELFLogger logger = EELFManager.getInstance().getLogger(CommandTask.class);
- public void onRequestCompletion(CommandResponse response, boolean isAAIUpdated) {
- logger.debug("Entry: onRequestCompletion()");
- requestHandler.onRequestExecutionEnd(commandRequest, isAAIUpdated);
+ public void setWorkflowManager(WorkFlowManager workflowManager) {
+ this.workflowManager = workflowManager;
}
- public abstract void onRequestCompletion(CommandResponse response);
+ public void setRequestHandler(RequestHandler requestHandler) {
+ this.requestHandler = requestHandler;
+ }
- protected CommandResponse buildCommandResponse(WorkflowResponse response) {
+ public CommandTask(RequestHandler requestHandler,
+ WorkFlowManager workflowManager){
+ this.requestHandler = requestHandler;
+ this.workflowManager = workflowManager;
+ getAAIservice();
+ }
- return new CommandResponse(commandRequest);
+ 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.onap.ccsdk.sli.adaptors.aai.AAIService");
+
+ }
}
- public void execute() {
- final RuntimeContext runtimeContext = commandRequest;
+ @Override
+ public void run() {
+ logger.debug("Starting execution of command :"+ commandRequest);
+ setInitialLogProperties(commandRequest);
+ final RuntimeContext runtimeContext = commandRequest.getCommandExecutorInput().getRuntimeContext();
+
+
WorkflowRequest workflowRequest = new WorkflowRequest();
workflowRequest.setRequestContext(runtimeContext.getRequestContext());
workflowRequest.setResponseContext(runtimeContext.getResponseContext());
workflowRequest.setVnfContext(runtimeContext.getVnfContext());
+ logger.debug("Executing workflow :"+ workflowRequest);
+ workflowManager.executeWorkflow(workflowRequest);
+ logger.debug("Completed execution workflow with response:"+ commandRequest.getCommandExecutorInput().getRuntimeContext().getResponseContext());
+ try {
+ if (VNFOperation.Terminate == commandRequest.getCommandExecutorInput().getRuntimeContext().getRequestContext().getAction())
+ updateAAIForTerminate(commandRequest);
+ } catch (AAIServiceException e) {
+ logger.error("Exception = " + e);
+ // In case of any errors we are updating the response status code and message
+ Status updatedStatus = new Status();
+ updatedStatus.setCode(401);
+ updatedStatus.setMessage("Failed to update VNF status in A&AI");
+ commandRequest.getCommandExecutorInput().getRuntimeContext().getResponseContext().setStatus(updatedStatus);
+ throw new RuntimeException(e);
+ }finally {
+ requestHandler.onRequestExecutionEnd(commandRequest.getCommandExecutorInput().getRuntimeContext());
+ clearRequestLogProperties();
+ }
+ }
+
+ private void updateAAIForTerminate(CommandRequest commandRequest) throws AAIServiceException {
+ final int statusCode = commandRequest.getCommandExecutorInput().getRuntimeContext().getResponseContext().getStatus().getCode();
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Workflow Execution Status = "+ statusCode);
+ }
+ if (statusCode == 100 || statusCode == 400) {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx = getVnfdata(commandRequest.getCommandExecutorInput().getRuntimeContext().getVnfContext().getId(), "vnf", ctx);
+ aaiService.deleteGenericVnfData(commandRequest.getCommandExecutorInput().getRuntimeContext().getVnfContext().getId(), ctx.getAttribute("vnf.resource-version"));
- WorkflowResponse response = workflowManager.executeWorkflow(workflowRequest);
+ }
+ }
- CommandResponse commandResponse = buildCommandResponse(response);
- this.onRequestCompletion(commandResponse);
+ private SvcLogicContext getVnfdata(String vnf_id, String prefix,SvcLogicContext ctx) {
+ String key="generic-vnf.vnf-id = '"+ vnf_id+"'"+" AND http-header.Real-Time = 'true'";
+ 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 void setInitialLogProperties(CommandRequest request) {
+ MDC.put(MDC_KEY_REQUEST_ID, request.getCommandExecutorInput().getRuntimeContext().getRequestContext().getCommonHeader().getRequestId());
+ if (request.getCommandExecutorInput().getRuntimeContext().getRequestContext().getActionIdentifiers().getServiceInstanceId() != null)
+ MDC.put(MDC_SERVICE_INSTANCE_ID, request.getCommandExecutorInput().getRuntimeContext().getRequestContext().getActionIdentifiers().getServiceInstanceId());
+ MDC.put(LoggingConstants.MDCKeys.PARTNER_NAME, request.getCommandExecutorInput().getRuntimeContext().getRequestContext().getCommonHeader().getOriginatorId());
+ MDC.put(MDC_SERVICE_NAME, request.getCommandExecutorInput().getRuntimeContext().getRequestContext().getAction().name());
+ try {
+ MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getCanonicalHostName());
+ MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress());
+ } catch (Exception e) {
+ logger.error(e.getMessage(),e);
+ }
+ MDC.put(MDC_INSTANCE_UUID, ""); // make instanse_UUID generation once during APPC-instanse deploying
+ }
+
+ private void clearRequestLogProperties()
+ {
+ try {
+ MDC.remove(MDC_KEY_REQUEST_ID);
+ MDC.remove(MDC_SERVICE_INSTANCE_ID);
+ MDC.remove(MDC_SERVICE_NAME);
+ MDC.remove(LoggingConstants.MDCKeys.PARTNER_NAME);
+ } catch (Exception e) {
+ logger.error(e.getMessage(),e);
+ }
+ }
}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommandTaskFactory.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommandTaskFactory.java
deleted file mode 100644
index ac75e627e..000000000
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommandTaskFactory.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.executor.impl;
-
-
-import org.onap.appc.domainmodel.lcm.ActionLevel;
-import org.onap.appc.domainmodel.lcm.RuntimeContext;
-import org.onap.appc.lifecyclemanager.LifecycleManager;
-import org.onap.appc.requesthandler.RequestHandler;
-import org.onap.appc.workflow.WorkFlowManager;
-
-
-
-
-public class CommandTaskFactory {
-
-// private LCMCommandTask lcmCommandTask;
-// private LCMReadonlyCommandTask LCMReadonlyCommandTask;
-
- private RequestHandler vnfRequestHandler;
- private RequestHandler vmRequestHandler;
- private WorkFlowManager workflowManager;
- private LifecycleManager lifecyclemanager;
-
-
- public void setWorkflowManager(WorkFlowManager workflowManager) {
- this.workflowManager = workflowManager;
- }
-
- public void setVnfRequestHandler(RequestHandler vnfRequestHandler) {
- this.vnfRequestHandler = vnfRequestHandler;
- }
-
- public void setVmRequestHandler(RequestHandler vmRequestHandler) {
- this.vmRequestHandler = vmRequestHandler;
- }
-
- public void setLifecyclemanager(LifecycleManager lifecyclemanager) {
- this.lifecyclemanager = lifecyclemanager;
- }
-
-
- public synchronized CommandTask getExecutionTask(RuntimeContext runtimeContext){
- String action = runtimeContext.getRequestContext().getAction().name();
- ActionLevel actionLevel = runtimeContext.getRequestContext().getActionLevel();
- RequestHandler requestHandler = readRequestHandler(actionLevel);
- if(ActionLevel.VM.equals(actionLevel)){
- return new LCMReadonlyCommandTask(runtimeContext,requestHandler,workflowManager);
- }
- switch (runtimeContext.getRequestContext().getAction().getOperationType()){
- case ReadOnly:
- case OperationStatusUpdate:
- return new LCMReadonlyCommandTask(runtimeContext,requestHandler,workflowManager);
- default:
- return new LCMCommandTask(runtimeContext,requestHandler,workflowManager,
- lifecyclemanager);
- }
- }
-
- private RequestHandler readRequestHandler(ActionLevel actionLevel) {
- if (ActionLevel.VM.equals(actionLevel)) {
- return vmRequestHandler;
- }
- return vnfRequestHandler;
- }
-
-}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommonMethods.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommonMethods.java
deleted file mode 100644
index a032f3737..000000000
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/CommonMethods.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.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/onap/appc/executor/impl/ExpiredMessageHandler.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/ExpiredMessageHandler.java
deleted file mode 100644
index bd5773216..000000000
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/ExpiredMessageHandler.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.executor.impl;
-
-import org.onap.appc.domainmodel.lcm.RuntimeContext;
-import org.onap.appc.domainmodel.lcm.ActionLevel;
-import org.onap.appc.executionqueue.MessageExpirationListener;
-import org.onap.appc.requesthandler.RequestHandler;
-
-
-public class ExpiredMessageHandler<M> implements MessageExpirationListener<M>{
- private RequestHandler vnfRequestHandler;
-
- private RequestHandler vmRequestHandler;
-
- public ExpiredMessageHandler(){
-
- }
-
- public void setVnfRequestHandler(RequestHandler vnfRequestHandler) {
- this.vnfRequestHandler = vnfRequestHandler;
- }
-
- public void setVmRequestHandler(RequestHandler vmRequestHandler) {
- this.vmRequestHandler = vmRequestHandler;
- }
-
- @Override
- public void onMessageExpiration(M message) {
- RuntimeContext commandRequest = (RuntimeContext)message;
- RequestHandler requestHandler = readRequestHandler(commandRequest);
- requestHandler.onRequestTTLEnd(commandRequest, true);
- }
-
- private RequestHandler readRequestHandler(RuntimeContext runtimeContext) {
- if(ActionLevel.VM.equals(runtimeContext.getRequestContext().getActionLevel())){
- return vmRequestHandler;
- }
- return vnfRequestHandler;
- }
-}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/LCMCommandTask.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/LCMCommandTask.java
deleted file mode 100644
index 13642ba36..000000000
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/LCMCommandTask.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.executor.impl;
-
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.lang3.StringUtils;
-import org.onap.appc.domainmodel.lcm.CommonHeader;
-import org.onap.appc.domainmodel.lcm.RuntimeContext;
-import org.onap.appc.domainmodel.lcm.Status;
-import org.onap.appc.domainmodel.lcm.VNFOperation;
-import org.onap.appc.executor.UnstableVNFException;
-import org.onap.appc.executor.objects.CommandResponse;
-import org.onap.appc.executor.objects.LCMCommandStatus;
-import org.onap.appc.executor.objects.Params;
-import org.onap.appc.executor.objects.UniqueRequestIdentifier;
-import org.onap.appc.lifecyclemanager.LifecycleManager;
-import org.onap.appc.lifecyclemanager.objects.LifecycleException;
-import org.onap.appc.lifecyclemanager.objects.NoTransitionDefinedException;
-import org.onap.appc.lifecyclemanager.objects.VNFOperationOutcome;
-import org.onap.appc.logging.LoggingConstants;
-import org.onap.appc.requesthandler.RequestHandler;
-import org.onap.appc.workflow.WorkFlowManager;
-import org.onap.appc.workflow.objects.WorkflowResponse;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
-import org.onap.ccsdk.sli.adaptors.aai.AAIService;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceReference;
-import org.slf4j.MDC;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-import java.net.InetAddress;
-import static com.att.eelf.configuration.Configuration.*;
-import static com.att.eelf.configuration.Configuration.MDC_SERVICE_INSTANCE_ID;
-import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME;
-
-
-public class LCMCommandTask extends CommandTask {
-
- private final AAIService aaiService;
- private final LifecycleManager lifecyclemanager;
-
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(LCMCommandTask.class);
-
- public LCMCommandTask(RuntimeContext commandRequest, RequestHandler requestHandler, WorkFlowManager workflowManager,
- LifecycleManager lifecyclemanager) {
- super(commandRequest, requestHandler, workflowManager);
- this.lifecyclemanager = lifecyclemanager;
-
- 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.onap.ccsdk.sli.adaptors.aai.AAIService");
- aaiService = null;
- }
- }
-
-
- @Override
- public void onRequestCompletion(CommandResponse response) {
- final RuntimeContext request = commandRequest;
- boolean isAAIUpdated = false;
- try {
-
- final int statusCode = request.getResponseContext().getStatus().getCode();
-
- if (logger.isDebugEnabled()) {
- logger.debug("Workflow Execution Status = "+ statusCode);
- }
-
- boolean isSuccess = statusCode == 100 || statusCode == 400;
-
- if (isSuccess && VNFOperation.Terminate == request.getRequestContext().getAction()) {
- SvcLogicContext ctx = new SvcLogicContext();
- ctx = getVnfdata(request.getVnfContext().getId(), "vnf", ctx);
- isAAIUpdated = aaiService.deleteGenericVnfData(request.getVnfContext().getId(), ctx.getAttribute("vnf.resource-version"));
- }
- else{
- isAAIUpdated = updateAAI(request.getVnfContext().getId() , false, isSuccess);
- }
- logger.debug("isAAIUpdated = " + isAAIUpdated);
- if(!isAAIUpdated){
- throw new Exception();
- }
- }
- catch(Exception e1) {
- logger.error("Exception = " + e1);
- // In case of any errors we are updating the response status code and message
- Status updatedStatus = new Status(401, "Fail to update VNF status in A&AI");
- request.getResponseContext().setStatus(updatedStatus);
- throw new RuntimeException(e1);
- }
- finally {
- super.onRequestCompletion(response, isAAIUpdated);
- }
- }
-
- @Override
- public void run() {
- final RuntimeContext request = commandRequest;
- setInitialLogProperties(request);
- boolean isAAIUpdated = false;
- final String vnfId = request.getVnfContext().getId();
- final String vnfType = request.getVnfContext().getType();
- try {
- final CommonHeader commonHeader = request.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.getVnfContext().getStatus();
- final VNFOperation action = request.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);
- Params params = new Params().addParam("actionName",e.event).addParam("currentState",e.currentState);
- request.getResponseContext().setStatus(LCMCommandStatus.NO_TRANSITION_DEFINE_FAILURE.toStatus(params));
- isAAIUpdated = false;
- } catch (UnstableVNFException e) {
- logger.error(e.getMessage(), e);
- Params params = new Params().addParam("vnfId",vnfId);
- request.getResponseContext().setStatus(LCMCommandStatus.UNSTABLE_VNF_FAILURE.toStatus(params));
- isAAIUpdated = false;
- }catch (Exception e) {
- logger.error("Error before Request Execution starts.", e);
- String errorMsg = StringUtils.isEmpty(e.getMessage()) ? e.toString() : e.getMessage();
- Params params = new Params().addParam("errorMsg",errorMsg);
- request.getResponseContext().setStatus(LCMCommandStatus.UNEXPECTED_FAILURE.toStatus(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.getResponseContext());
- CommandResponse commandResponse = super.buildCommandResponse(response);
- this.onRequestCompletion(commandResponse);
- }
-
- clearRequestLogProperties();
- }
-
-
- 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="generic-vnf.vnf-id = '"+ vnf_id+"'"+" AND http-header.Real-Time = 'true'";
- 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;
- }
-
- protected void setInitialLogProperties(RuntimeContext request)
- {
- MDC.put(MDC_KEY_REQUEST_ID, request.getRequestContext().getCommonHeader().getRequestId());
- if (request.getRequestContext().getActionIdentifiers().getServiceInstanceId() != null)
- MDC.put(MDC_SERVICE_INSTANCE_ID, request.getRequestContext().getActionIdentifiers().getServiceInstanceId());
- MDC.put(LoggingConstants.MDCKeys.PARTNER_NAME, request.getRequestContext().getCommonHeader().getOriginatorId());
- MDC.put(MDC_SERVICE_NAME, request.getRequestContext().getAction().name());
- try {
- MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getCanonicalHostName());
- 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
- }
-
- protected void clearRequestLogProperties()
- {
- try {
- MDC.remove(MDC_KEY_REQUEST_ID);
- MDC.remove(MDC_SERVICE_INSTANCE_ID);
- MDC.remove(MDC_SERVICE_NAME);
- MDC.remove(LoggingConstants.MDCKeys.PARTNER_NAME);
- } catch (Exception e) {
-
- }
- }
-}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/LCMReadonlyCommandTask.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/LCMReadonlyCommandTask.java
deleted file mode 100644
index 0eeefe540..000000000
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/LCMReadonlyCommandTask.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.executor.impl;
-
-
-import org.apache.commons.lang3.StringUtils;
-import org.onap.appc.domainmodel.lcm.CommonHeader;
-import org.onap.appc.domainmodel.lcm.RuntimeContext;
-import org.onap.appc.executor.UnstableVNFException;
-import org.onap.appc.executor.objects.CommandResponse;
-import org.onap.appc.executor.objects.LCMCommandStatus;
-import org.onap.appc.executor.objects.Params;
-import org.onap.appc.executor.objects.UniqueRequestIdentifier;
-import org.onap.appc.requesthandler.RequestHandler;
-import org.onap.appc.workflow.WorkFlowManager;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class LCMReadonlyCommandTask extends CommandTask {
-
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(LCMReadonlyCommandTask.class);
-
- public LCMReadonlyCommandTask(RuntimeContext commandRequest, RequestHandler requestHandler,
- WorkFlowManager workflowManager) {
- super(commandRequest, requestHandler, workflowManager);
- }
-
- @Override
- public void onRequestCompletion(CommandResponse response) {
- super.onRequestCompletion(response, true);
- }
-
- @Override
- public void run() {
- RuntimeContext request = commandRequest;
- final CommonHeader commonHeader = request.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.getVnfContext().getId();
- try {
- requestHandler.onRequestExecutionStart(vnfId,true, requestIdentifierString, forceFlag);
- super.execute();
- } catch (UnstableVNFException e) {
- logger.error(e.getMessage(), e);
- Params params = new Params().addParam("vnfId",vnfId);
- request.getResponseContext().setStatus(LCMCommandStatus.UNSTABLE_VNF_FAILURE.toStatus(params));
- }catch (Exception e) {
- logger.error("Error during runing LCMReadonlyCommandTask.", e);
- String errorMsg = StringUtils.isEmpty(e.getMessage()) ? e.toString() : e.getMessage();
- Params params = new Params().addParam("errorMsg",errorMsg);
- request.getResponseContext().setStatus(LCMCommandStatus.UNEXPECTED_FAILURE.toStatus(params));
- }
- }
-}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/conv/Converter.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/objects/CommandRequest.java
index 3cfc7ece7..90b5be924 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/conv/Converter.java
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/onap/appc/executor/impl/objects/CommandRequest.java
@@ -22,31 +22,44 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.appc.executor.conv;
+package org.onap.appc.executor.impl.objects;
-import java.io.IOException;
+import java.util.Date;
-import org.onap.appc.executor.objects.Params;
+import org.onap.appc.executor.objects.CommandExecutorInput;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
+public class CommandRequest {
-public class Converter {
+ private CommandExecutorInput commandExecutorInput;
+ private Date commandInTimeStamp;
- public static Params convJsonStringToParams(String inObj) throws IOException {
- Params outObj = null;
- if(inObj != null) {
- outObj = new ObjectMapper().readValue(inObj, Params.class);
- }
- return outObj;
+ public CommandRequest(CommandExecutorInput commandExecutorInput) {
+ this.commandExecutorInput = commandExecutorInput;
}
- public static String convParamsToJsonString(Params inObj) throws JsonProcessingException {
- String outObj = null;
- if(inObj != null) {
- outObj = new ObjectMapper().writeValueAsString(inObj);
- }
- return outObj;
+
+ 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 String toString() {
+ return "CommandRequest{" +
+ "commandExecutorInput=" + commandExecutorInput +
+ ", commandInTimeStamp=" + commandInTimeStamp +
+ '}';
}
}
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
index d0ee8cd05..aa4e129fc 100644
--- 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
@@ -32,35 +32,14 @@
<bean id="commandExecutorBean" class="org.onap.appc.executor.impl.CommandExecutorImpl"
scope="singleton" init-method="initialize">
<property name="executionQueueService" ref="ExecutionQueueServiceRef"/>
- <property name="executionTaskFactory" ref="CommandExecutionTaskFactory"/>
- <property name="expiredMessageHandler" ref="expiredMessageHandlerBean"/>
+ <property name="workflowManager" ref="WorkFlowManagerRef" />
+ <property name="requestHandler" ref="RequestHandlerService" />
</bean>
- <bean id="CommandExecutionTaskFactory" class="org.onap.appc.executor.impl.CommandTaskFactory"
- scope="singleton">
- <property name="vnfRequestHandler" ref="vnfRequestHandlerService"/>
- <property name="vmRequestHandler" ref="vmRequestHandlerService"/>
- <property name="workflowManager" ref="WorkFlowManagerRef"/>
- <property name="lifecyclemanager" ref="LifecyclemanagerRef"/>
- </bean>
-
- <bean id="expiredMessageHandlerBean" class="org.onap.appc.executor.impl.ExpiredMessageHandler"
- scope="singleton">
- <property name="vnfRequestHandler" ref="vnfRequestHandlerService"/>
- <property name="vmRequestHandler" ref="vmRequestHandlerService"/>
- </bean>
- <reference id="WorkFlowManagerRef" availability="mandatory" activation="eager"
- interface="org.onap.appc.workflow.WorkFlowManager"/>
- <reference id="vnfRequestHandlerService" availability="optional" activation="eager"
- interface="org.onap.appc.requesthandler.RequestHandler" filter="(level=VNF)"/>
- <reference id="vmRequestHandlerService" availability="optional" activation="eager"
- interface="org.onap.appc.requesthandler.RequestHandler" filter="(level=VM)"/>
- <reference id="LifecyclemanagerRef" availability="mandatory" activation="eager"
- interface="org.onap.appc.lifecyclemanager.LifecycleManager"/>
- <reference id="ExecutionQueueServiceRef" availability="mandatory" activation="eager"
- interface="org.onap.appc.executionqueue.ExecutionQueueService"/>
+ <reference id="WorkFlowManagerRef" availability="mandatory" activation="eager" interface="org.onap.appc.workflow.WorkFlowManager" />
+ <reference id="RequestHandlerService" availability="optional" activation="eager" interface="org.onap.appc.requesthandler.RequestHandler" filter="(level=VNF)" />
+ <reference id="ExecutionQueueServiceRef" availability="mandatory" activation="eager" interface="org.onap.appc.executionqueue.ExecutionQueueService" />
- <service id="commandExecutorService" interface="org.onap.appc.executor.CommandExecutor"
- ref="commandExecutorBean"/>
+ <service id="commandExecutorService" interface="org.onap.appc.executor.CommandExecutor" ref="commandExecutorBean"/>
</blueprint>
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/resources/org/onap/appc/default.properties b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/resources/org/onap/appc/default.properties
index f24ee14ee..5899c6a8c 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/resources/org/onap/appc/default.properties
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/resources/org/onap/appc/default.properties
@@ -33,6 +33,6 @@ appc.LCM.poolMembers=<DMAAP_IP>:3904
appc.LCM.service=dmaap
appc.LCM.topic.write=APPC-TEST2
appc.LCM.client.name=APPC-TEST-CLIENT-CMD-EXECUTOR-MAIN
-appc.LCM.provider.user=test
-appc.LCM.provider.pass=test
+appc.LCM.provider.user=admin
+appc.LCM.provider.pass=admin
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/onap/appc/executor/CommandExecutionTaskTest.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/onap/appc/executor/CommandExecutionTaskTest.java
deleted file mode 100644
index af62a06f6..000000000
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/onap/appc/executor/CommandExecutionTaskTest.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.executor;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.onap.appc.domainmodel.lcm.ActionIdentifiers;
-import org.onap.appc.domainmodel.lcm.CommonHeader;
-import org.onap.appc.domainmodel.lcm.Flags;
-import org.onap.appc.domainmodel.lcm.RequestContext;
-import org.onap.appc.domainmodel.lcm.ResponseContext;
-import org.onap.appc.domainmodel.lcm.RuntimeContext;
-import org.onap.appc.domainmodel.lcm.Status;
-import org.onap.appc.domainmodel.lcm.VNFContext;
-import org.onap.appc.domainmodel.lcm.VNFOperation;
-import org.onap.appc.executor.impl.CommandTask;
-import org.onap.appc.executor.impl.CommandTaskFactory;
-import org.onap.appc.executor.impl.LCMCommandTask;
-import org.onap.appc.executor.impl.LCMReadonlyCommandTask;
-import org.onap.appc.executor.objects.CommandResponse;
-import org.onap.appc.lifecyclemanager.LifecycleManager;
-import org.onap.appc.requesthandler.RequestHandler;
-import org.onap.appc.workflow.WorkFlowManager;
-import org.onap.appc.workflow.objects.WorkflowResponse;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
-import org.onap.ccsdk.sli.adaptors.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.time.Instant;
-
-import static junit.framework.Assert.assertEquals;
-import static org.mockito.Matchers.*;
-
-@SuppressWarnings("unchecked")
-@RunWith(PowerMockRunner.class)
-@PrepareForTest( {FrameworkUtil.class, CommandTask.class, LCMCommandTask.class})
-public class CommandExecutionTaskTest {
-
- private final String TTL_FLAG= "TTL";
- private final String API_VERSION= "2.0.0";
- private final String ORIGINATOR_ID= "1";
- 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.<AAIService>getService(sref)).thenReturn(aaiService);
- PowerMockito.when(aaiService.query(anyString(),anyBoolean(),anyString(),anyString(),anyString(),
- anyString(), anyObject())).thenAnswer(invocation -> {
- 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(), anyObject(), anyString(),
- anyObject())).thenReturn(SvcLogicResource.QueryStatus.SUCCESS);
-
- requestHandler = Mockito.mock(RequestHandler.class);
- workflowManager = Mockito.mock(WorkFlowManager.class);
- lifecyclemanager = Mockito.mock(LifecycleManager.class );
-
- factory = new CommandTaskFactory();
- factory.setLifecyclemanager(lifecyclemanager);
- factory.setWorkflowManager(workflowManager);
- factory.setVnfRequestHandler(requestHandler);
- Mockito.when(workflowManager.executeWorkflow(anyObject())).thenReturn(getWorkflowResponse ());
- }
-
-
- @Test
- public void testFactory(){
- CommandTask task;
- Instant timeStamp = Instant.now();
- String requestId = "1";
- RuntimeContext commandExecutorInputConfigure = pouplateCommandExecutorInput("FIREWALL", 30, "1.0",
- timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "2", VNFOperation.Configure,"15","") ;
- task = factory.getExecutionTask(commandExecutorInputConfigure);
- assertEquals(LCMCommandTask.class,task.getClass() );
- RuntimeContext commandExecutorInputSync = pouplateCommandExecutorInput("FIREWALL", 30, "1.0",
- timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "2", VNFOperation.Sync,"15","") ;
- task = factory.getExecutionTask(commandExecutorInputSync);
- assertEquals(LCMReadonlyCommandTask.class,task.getClass() );
-
- }
-
-
-
- @Test
- public void testOnRequestCompletion(){
- Mockito.doNothing().when(requestHandler).onRequestTTLEnd(anyObject(),anyBoolean());
- RuntimeContext request = pouplateCommandExecutorInput("FIREWALL", 30, "1.0",
- Instant.now(), API_VERSION, "11", ORIGINATOR_ID, "", VNFOperation.Configure,
- "1", "");
- CommandResponse response = getCommandResponse(VNFOperation.Configure, true, "11",
- "","1");
- LCMCommandTask executionTask = new LCMCommandTask(request, requestHandler,workflowManager,lifecyclemanager);
- executionTask.onRequestCompletion(response);
- }
-
- @Test
- public void testRunGetConfig(){
- RuntimeContext request = pouplateCommandExecutorInput("FIREWALL", 30, "1.0",
- Instant.now(), API_VERSION, "11", ORIGINATOR_ID, "", VNFOperation.Sync,
- "1", "");
- LCMReadonlyCommandTask readonlyCommandTask = new LCMReadonlyCommandTask(
- request, requestHandler,workflowManager);
- readonlyCommandTask.run();
- }
-
- @Test
- public void testRun(){
- RuntimeContext request = pouplateCommandExecutorInput("FIREWALL", 30, "1.0",
- Instant.now(), API_VERSION, "11", ORIGINATOR_ID, "", VNFOperation.Sync,
- "1", "");
- LCMCommandTask executionTask = new LCMCommandTask(request, requestHandler,workflowManager,lifecyclemanager);
- executionTask.run();
- }
-
- @Test
- public void testRunNegative(){
- RuntimeContext request = pouplateCommandExecutorInput("FIREWALL", 30, "1.0",
- Instant.now(), API_VERSION, "11", ORIGINATOR_ID, "", VNFOperation.Sync,
- "1", "");
- LCMCommandTask executionTask = new LCMCommandTask(request, requestHandler,workflowManager,lifecyclemanager);
- executionTask.run();
- }
-
-
- private CommandResponse getCommandResponse(VNFOperation action,
- boolean success,
- String responseId,
- String payload,
- String vnfId){
- RuntimeContext runtimeContext = new 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);
- commonHeader.setFlags(new Flags(null, false, 0));
- 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);
- responseContext.setStatus(new Status(100, null));
- commonHeader.setRequestId(responseId);
- responseContext.setPayload(payload);
- commonHeader.setTimestamp(Instant.now());
- vnfContext.setId(vnfId);
- return new CommandResponse(runtimeContext);
- }
-
-
-
- @Test
- public void testPositiveFlow_configure() {
-
- String requestId = "1";
-
- pouplateCommandExecutorInput("FIREWALL",30,
- "1.0", Instant.now(), API_VERSION, requestId, ORIGINATOR_ID, "",
- VNFOperation.Configure, "33", "");
- }
-
- public WorkflowResponse getWorkflowResponse (){
- WorkflowResponse wfResponse = new WorkflowResponse();
- ResponseContext responseContext = createResponseContextWithSuObjects();
- wfResponse.setResponseContext(responseContext);
- responseContext.setPayload("");
- wfResponse.getResponseContext().setStatus(new Status(100, null));
- return wfResponse;
- }
-
- private RuntimeContext pouplateCommandExecutorInput(String vnfType,
- int ttl,
- String vnfVersion,
- Instant timeStamp,
- String apiVersion,
- String requestId,
- String originatorID,
- String subRequestID,
- VNFOperation action,
- String vnfId,
- String payload){
- RuntimeContext commandExecutorInput = createCommandExecutorInputWithSubObjects();
- RequestContext requestContext = commandExecutorInput.getRequestContext();
- ResponseContext responseContext = createResponseContextWithSuObjects();
- commandExecutorInput.setResponseContext(responseContext);
-
- requestContext.getCommonHeader().setFlags(new Flags(null, false, 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 = commandExecutorInput.getVnfContext();
- vnfContext.setType(vnfType);
- vnfContext.setId(vnfId);
- vnfContext.setVersion(vnfVersion);
- return commandExecutorInput;
- }
-
- private RuntimeContext createCommandExecutorInputWithSubObjects() {
- return createRuntimeContextWithSubObjects();
- }
-
- private RuntimeContext createRuntimeContextWithSubObjects() {
- RuntimeContext runtimeContext = new RuntimeContext();
- RequestContext requestContext = new RequestContext();
- runtimeContext.setRequestContext(requestContext);
- CommonHeader commonHeader = new CommonHeader();
- requestContext.setCommonHeader(commonHeader);
- commonHeader.setFlags(new Flags(null, false, 0));
- 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();
- responseContext.setCommonHeader(commonHeader);
- responseContext.setStatus(new Status(0, null));
- commonHeader.setFlags(new Flags(null, false, 0));
- return responseContext;
- }
-
-}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/onap/appc/executor/TestCommandExecutor.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/onap/appc/executor/TestCommandExecutor.java
index cd02c260d..fcf45d59d 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/onap/appc/executor/TestCommandExecutor.java
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/onap/appc/executor/TestCommandExecutor.java
@@ -24,30 +24,29 @@
package org.onap.appc.executor;
/**
- *
+ *
*/
-import java.time.Instant;
-
import org.junit.Assert;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.Mockito;
-import org.onap.appc.domainmodel.lcm.ActionIdentifiers;
-import org.onap.appc.domainmodel.lcm.CommonHeader;
-import org.onap.appc.domainmodel.lcm.Flags;
-import org.onap.appc.domainmodel.lcm.RequestContext;
-import org.onap.appc.domainmodel.lcm.RuntimeContext;
-import org.onap.appc.domainmodel.lcm.VNFContext;
-import org.onap.appc.domainmodel.lcm.VNFOperation;
+import org.onap.appc.domainmodel.lcm.*;
import org.onap.appc.exceptions.APPCException;
import org.onap.appc.executionqueue.ExecutionQueueService;
import org.onap.appc.executor.impl.*;
+import org.onap.appc.executor.impl.objects.CommandRequest;
+import org.onap.appc.executor.objects.CommandExecutorInput;
import org.onap.appc.lifecyclemanager.LifecycleManager;
import org.onap.appc.requesthandler.RequestHandler;
import org.onap.appc.workflow.WorkFlowManager;
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.concurrent.TimeUnit;
@@ -55,113 +54,99 @@ import java.util.concurrent.TimeUnit;
import static junit.framework.Assert.assertTrue;
import static org.powermock.api.support.membermodification.MemberMatcher.method;
-
-@SuppressWarnings("deprecation")
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({CommandTask.class,CommandExecutorImpl.class})
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";
-
- private CommandExecutorImpl commandExecutor;
-
- private CommandTaskFactory executionTaskFactory;
-
- private RequestHandler requestHandler;
- private WorkFlowManager workflowManager;
- private LifecycleManager lifecyclemanager;
-
- private ExecutionQueueService executionQueueService;
- private Instant timeStamp = Instant.now();
- private String requestId = "1";
- private RuntimeContext commandExecutorInputConfigure = pouplateCommandExecutorInput("FIREWALL", 30000, "1.0",
- timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "2", VNFOperation.Configure,"15","") ;
- private RuntimeContext commandExecutorInputSync = pouplateCommandExecutorInput("FIREWALL", 30, "1.0",
- timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "2", VNFOperation.Sync,"15","") ;
-
- @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(commandExecutorInputConfigure)).thenReturn(lcmCommandTask);
- Mockito.when(executionTaskFactory.getExecutionTask(commandExecutorInputSync)).thenReturn(lCMReadonlyCommandTask);
-
-// Mockito.when(executionQueueService.putMessage((Runnable) Mockito.anyObject(),Mockito.anyLong(),(TimeUnit)Mockito.anyObject())).thenReturn(true);
-
- }
-
-
- @Test
- public void testPositiveFlow_LCM() throws Exception {
- //Map <String,Object> flags = setTTLInFlags("30");
- String requestId = "1";
- RuntimeContext commandExecutorInput = pouplateCommandExecutorInput("FIREWALL", 30, "1.0", Instant.now(), 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(){
- String requestId = "1";
-
- RuntimeContext commandExecutorInput = pouplateCommandExecutorInput("FIREWALL", 30, "1.0", Instant.now(), API_VERSION, requestId, ORIGINATOR_ID, "2", VNFOperation.Sync,"15","") ;
- try {
- commandExecutor.executeCommand(commandExecutorInput);
- } catch (APPCException e) {
- Assert.fail(e.toString());
- }
-
- }
-
-
- private RuntimeContext pouplateCommandExecutorInput(String vnfType, int ttl, String vnfVersion, Instant timeStamp, String apiVersion, String requestId, String originatorID, String subRequestID, VNFOperation action, String vnfId , String payload){
- RuntimeContext commandExecutorInput = createCommandExecutorInputWithSubObjects();
- RequestContext requestContext = commandExecutorInput.getRequestContext();
- requestContext.getCommonHeader().setFlags(new Flags(null, false, 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 = commandExecutorInput.getVnfContext();
- vnfContext.setType(vnfType);
- vnfContext.setId(vnfId);
- vnfContext.setVersion(vnfVersion);
- return commandExecutorInput;
- }
-
- private RuntimeContext createCommandExecutorInputWithSubObjects() {
- RuntimeContext runtimeContext = new RuntimeContext();
+ private static final String TTL_FLAG= "TTL";
+ private static final String API_VERSION= "2.0.0";
+ private static final String ORIGINATOR_ID= "1";
+
+ private CommandExecutorImpl commandExecutor;
+
+ private RequestHandler requestHandler;
+ private WorkFlowManager workflowManager;
+ private ExecutionQueueService executionQueueService;
+
+ private Date timeStamp = new Date();
+ private String requestId = "1";
+ private CommandExecutorInput commandExecutorInputConfigure = pouplateCommandExecutorInput("FIREWALL", 30000, "1.0",
+ timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "2", VNFOperation.Configure,"15","") ;
+ private CommandExecutorInput commandExecutorInputSync = pouplateCommandExecutorInput("FIREWALL", 30, "1.0",
+ timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "2", VNFOperation.Sync,"15","") ;
+
+ @Before
+ public void init()throws Exception {
+ requestHandler= Mockito.mock(RequestHandler.class);
+ workflowManager= Mockito.mock(WorkFlowManager.class);
+
+ executionQueueService = Mockito.mock(ExecutionQueueService.class);
+
+ commandExecutor = new CommandExecutorImpl();
+ commandExecutor.setExecutionQueueService(executionQueueService);
+ commandExecutor.setRequestHandler(requestHandler);
+ commandExecutor.setWorkflowManager(workflowManager);
+ commandExecutor.initialize();
+ CommandTask commandTask = Mockito.mock(CommandTask.class);
+ Mockito.when(commandTask.getCommandRequest()).thenReturn(new CommandRequest(commandExecutorInputConfigure));
+ PowerMockito.whenNew(CommandTask.class).withParameterTypes(RequestHandler.class,WorkFlowManager.class).withArguments(requestHandler,workflowManager).thenReturn(commandTask);
+ }
+
+
+ @Test
+ public void testPositiveFlow_LCM() throws Exception {
+ //Map <String,Object> flags = setTTLInFlags("30");
+ try {
+ commandExecutor.executeCommand(commandExecutorInputConfigure);
+ } catch (APPCException e) {
+ Assert.fail(e.toString());
+ }
+
+ }
+
+ @Test(expected = APPCException.class)
+ public void testNegativeFlow_LCM() throws APPCException{
+ Mockito.doThrow(new APPCException("Failed to enqueue request")).when(executionQueueService).putMessage((Runnable) Mockito.anyObject(),Mockito.anyLong(),(TimeUnit) Mockito.anyObject());
+ commandExecutor.executeCommand(commandExecutorInputSync);
+ }
+
+
+ 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);
- commonHeader.setFlags(new Flags(null, false, 0));
- ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
- requestContext.setActionIdentifiers(actionIdentifiers);
- VNFContext vnfContext = new VNFContext();
- runtimeContext.setVnfContext(vnfContext);
- return runtimeContext;
- }
-
-
+ 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/java/org/onap/appc/executor/TestCommandTask.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/onap/appc/executor/TestCommandTask.java
new file mode 100644
index 000000000..d21e788f3
--- /dev/null
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/onap/appc/executor/TestCommandTask.java
@@ -0,0 +1,231 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.appc.executor;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.onap.appc.domainmodel.lcm.*;
+import org.onap.appc.executor.impl.CommandExecutorImpl;
+import org.onap.appc.executor.impl.CommandTask;
+import org.onap.appc.executor.impl.objects.CommandRequest;
+import org.onap.appc.executor.objects.CommandExecutorInput;
+import org.onap.appc.requesthandler.RequestHandler;
+import org.onap.appc.workflow.WorkFlowManager;
+import org.onap.appc.workflow.objects.WorkflowRequest;
+import org.onap.appc.workflow.objects.WorkflowResponse;
+import org.onap.ccsdk.sli.adaptors.aai.AAIService;
+import org.osgi.framework.*;
+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 static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyObject;
+
+/**
+ * @author sushilma
+ * @since September 04, 2017
+ */
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({FrameworkUtil.class,AAIService.class,BundleContext.class,ServiceReference.class,
+ BundleReference.class,Bundle.class,Filter.class,BundleListener.class,InvalidSyntaxException.class,
+ BundleException.class,FrameworkListener.class,ServiceRegistration.class,ServiceListener.class,
+ Version.class})
+public class TestCommandTask {
+ CommandTask task ;
+ private RequestHandler requestHandler;
+ private WorkFlowManager workflowManager;
+ private CommandRequest commandRequest;
+ private AAIService aaiService;
+
+ private BundleContext bundleContext = Mockito.mock(BundleContext.class);
+ private Bundle bundleService = Mockito.mock(Bundle.class);
+ private ServiceReference sref = Mockito.mock(ServiceReference.class);
+
+ private static final String TTL_FLAG= "TTL";
+ private static final String API_VERSION= "2.0.0";
+ private static final String ORIGINATOR_ID= "1";
+ @Before
+ public void init(){
+ aaiService = Mockito.mock(AAIService.class);
+/* PowerMockito.mockStatic(FrameworkUtil.class);
+ Mockito.when(bundleContext.getServiceReference(AAIService.class.getName())).thenReturn(sref);
+ Mockito.when(bundleContext.getService(any())).thenReturn(aaiService);
+ Mockito.when(FrameworkUtil.getBundle(AAIService.class).getBundleContext()).thenReturn(bundleContext);*/
+
+ 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);
+
+
+ requestHandler = Mockito.mock(RequestHandler.class);
+ workflowManager = Mockito.mock(WorkFlowManager.class);
+ task = new CommandTask(requestHandler ,workflowManager );
+ }
+
+ @Test
+ public void testRunPositive(){
+ Mockito.when(workflowManager.executeWorkflow(anyObject())).thenReturn(getWorkflowResponse());
+ task.setWorkflowManager(workflowManager);
+ task.setRequestHandler(requestHandler);
+ task.setCommandRequest(getCommandRequest("FIREWALL",30,new Date(), "11" ,setTTLInFlags("30"),VNFOperation.Sync, "1", "1.0"));
+ task.run();
+ Assert.assertNotNull(task.getCommandRequest().getCommandExecutorInput().getRuntimeContext().getResponseContext());
+ }
+
+ @Test
+ public void testRunPositiveTerminateFailed(){
+ Mockito.when(workflowManager.executeWorkflow(anyObject())).thenReturn(getWorkflowResponse());
+ task.setWorkflowManager(workflowManager);
+ task.setRequestHandler(requestHandler);
+ task.setCommandRequest(getCommandRequest("FIREWALL",30,new Date(), "12" ,setTTLInFlags("30"),VNFOperation.Terminate, "2", "1.0"));
+ setResponseContext(300,task.getCommandRequest().getCommandExecutorInput().getRuntimeContext());
+ task.run();
+ Assert.assertNotNull(task.getCommandRequest().getCommandExecutorInput().getRuntimeContext().getResponseContext());
+ }
+
+
+ @Ignore
+ public void testRunPositiveTerminateSuccess(){
+ Mockito.when(workflowManager.executeWorkflow(anyObject())).thenReturn(getWorkflowResponse());
+ task.setWorkflowManager(workflowManager);
+ task.setRequestHandler(requestHandler);
+ task.setCommandRequest(getCommandRequest("FIREWALL",30,new Date(), "12" ,setTTLInFlags("30"),VNFOperation.Terminate, "2", "1.0"));
+ setResponseContext(100,task.getCommandRequest().getCommandExecutorInput().getRuntimeContext());
+ task.run();
+ Assert.assertNotNull(task.getCommandRequest().getCommandExecutorInput().getRuntimeContext().getResponseContext());
+ }
+
+ private WorkflowResponse getWorkflowResponse (){
+ WorkflowResponse wfResponse = new WorkflowResponse();
+ ResponseContext responseContext = createResponseContextWithObjects();
+ wfResponse.setResponseContext(responseContext);
+ responseContext.setPayload("");
+ wfResponse.getResponseContext().getStatus().setCode(100);
+ return wfResponse;
+ }
+
+ private ResponseContext createResponseContextWithObjects(){
+ 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;
+ }
+
+ private void setResponseContext(int statusCode ,RuntimeContext runtimeContext ){
+ ResponseContext responseContext = createResponseContextWithObjects();
+ responseContext.getStatus().setCode(statusCode);
+ runtimeContext.setResponseContext(responseContext);
+ }
+
+ private CommandRequest getCommandRequest(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, "");
+ CommandRequest request = new CommandRequest(commandExecutorInput);
+ request.setCommandExecutorInput(commandExecutorInput);
+ request.setCommandInTimeStamp(new Date());
+ return request;
+ }
+
+ 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);
+ requestContext.getActionIdentifiers().setServiceInstanceId("test");
+ 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 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;
+ }
+
+ 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 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;
+ }
+}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/resources/org/onap/appc/default.properties b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/resources/org/onap/appc/default.properties
index 671d8b0b2..28b45df11 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/resources/org/onap/appc/default.properties
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/resources/org/onap/appc/default.properties
@@ -88,4 +88,3 @@ appc.LCM.client.name=APPC-TEST-CLIENT-CMD-EXECUTOR-TEST
appc.LCM.provider.user=test
appc.LCM.provider.pass=test
-
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
index bed8584dc..566c1f4b4 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-features/pom.xml
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-features/pom.xml
@@ -1,107 +1,132 @@
<?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.onap.appc</groupId>
- <version>1.3.0-SNAPSHOT</version>
- </parent>
- <name>appc-command-executor-features</name>
- <artifactId>appc-command-executor-features</artifactId>
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APPC
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Copyright (C) 2017 Amdocs
+ =============================================================================
+ 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
- <packaging>jar</packaging>
+ http://www.apache.org/licenses/LICENSE-2.0
- <dependencies>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-command-executor-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-command-executor-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
+ 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.
- <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>
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ ============LICENSE_END=========================================================
+ -->
+<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.onap.appc</groupId>
+ <version>1.3.0-SNAPSHOT</version>
+ </parent>
- <!-- Skipping ODL feature test -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skipTests>true</skipTests>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <name>APPC Command Executor - Features</name>
+ <artifactId>appc-command-executor-features</artifactId>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.appc</groupId>
+ <artifactId>appc-command-executor-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.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
index fc1ec092e..0077d59d8 100644
--- 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
@@ -25,13 +25,14 @@
<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">
-
+ 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.onap.appc/execution-queue-management-lib/${project.version}</bundle>
+ <bundle>mvn:org.onap.appc/execution-queue-management-lib/${project.version}</bundle>
<bundle>mvn:org.onap.appc/appc-command-executor-api/${project.version}</bundle>
<bundle>mvn:org.onap.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/appc-command-executor-installer/.gitignore b/appc-dispatcher/appc-command-executor/appc-command-executor-installer/.gitignore
deleted file mode 100644
index 731eb433c..000000000
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-installer/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/target/
-/.settings/
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-installer/pom.xml b/appc-dispatcher/appc-command-executor/appc-command-executor-installer/pom.xml
deleted file mode 100644
index 407af7ef9..000000000
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-installer/pom.xml
+++ /dev/null
@@ -1,137 +0,0 @@
-<?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>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-command-executor</artifactId>
- <version>1.3.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>appc-command-executor-installer</artifactId>
- <name>APPC Command Executor - Karaf Installer</name>
- <packaging>pom</packaging>
-
- <properties>
- <application.name>appc-command-executor</application.name>
- <features.boot>appc-command-executor</features.boot>
- <features.repositories>
- mvn:org.onap.appc/appc-command-executor-features/${project.version}/xml/features
- </features.repositories>
- <include.transitive.dependencies>false</include.transitive.dependencies>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-command-executor-features</artifactId>
- <version>${project.version}</version>
- <classifier>features</classifier>
- <type>xml</type>
- <exclusions>
- <exclusion>
- <groupId>*</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-command-executor-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-command-executor-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>maven-repo-zip</id>
- <goals>
- <goal>single</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <appendAssemblyId>false</appendAssemblyId>
- <attach>false</attach>
- <finalName>stage/${application.name}-${project.version}</finalName>
- <descriptors>
- <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- <execution>
- <id>installer-zip</id>
- <goals>
- <goal>single</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <appendAssemblyId>false</appendAssemblyId>
- <attach>true</attach>
- <finalName>${application.name}-${project.version}</finalName>
- <descriptors>
- <descriptor>src/assembly/assemble_installer_zip.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <phase>prepare-package</phase>
- <configuration>
- <outputDirectory>${project.build.directory}/assembly/system</outputDirectory>
- <overWriteReleases>false</overWriteReleases>
- <overWriteSnapshots>true</overWriteSnapshots>
- <overWriteIfNewer>true</overWriteIfNewer>
- <useRepositoryLayout>true</useRepositoryLayout>
- <addParentPoms>false</addParentPoms>
- <copyPom>false</copyPom>
- <excludeGroupIds>org.opendaylight</excludeGroupIds>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-version</id>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <!-- here the phase you need -->
- <phase>validate</phase>
- <configuration>
- <outputDirectory>${basedir}/target/stage</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/resources/scripts</directory>
- <includes>
- <include>install-feature.sh</include>
- </includes>
- <filtering>true</filtering>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/assembly/assemble_installer_zip.xml b/appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/assembly/assemble_installer_zip.xml
deleted file mode 100644
index df18e1889..000000000
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/assembly/assemble_installer_zip.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<!--
- ============LICENSE_START=======================================================
- ONAP : APPC
- ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- ================================================================================
- Copyright (C) 2017 Amdocs
- =============================================================================
- 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.
-
- ECOMP is a trademark and service mark of AT&T Intellectual Property.
- ============LICENSE_END=========================================================
- -->
-
-<!-- Defines how we build the .zip file which is our distribution. -->
-
-<assembly
- xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
- <id>controller</id>
- <formats>
- <format>zip</format>
- </formats>
-
- <!-- we want "system" and related files right at the root level
- as this file is suppose to be unzip on top of a karaf
- distro. -->
- <includeBaseDirectory>false</includeBaseDirectory>
-
- <fileSets>
- <fileSet>
- <directory>target/stage/</directory>
- <outputDirectory>${application.name}</outputDirectory>
- <fileMode>755</fileMode>
- <includes>
- <include>*.sh</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>target/stage/</directory>
- <outputDirectory>${application.name}</outputDirectory>
- <fileMode>644</fileMode>
- <excludes>
- <exclude>*.sh</exclude>
- </excludes>
- </fileSet>
- </fileSets>
-
-</assembly>
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/assembly/assemble_mvnrepo_zip.xml b/appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/assembly/assemble_mvnrepo_zip.xml
deleted file mode 100644
index 4278b4d95..000000000
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/assembly/assemble_mvnrepo_zip.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<!--
- ============LICENSE_START=======================================================
- ONAP : APPC
- ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- ================================================================================
- Copyright (C) 2017 Amdocs
- =============================================================================
- 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.
-
- ECOMP is a trademark and service mark of AT&T Intellectual Property.
- ============LICENSE_END=========================================================
- -->
-
-<!-- Defines how we build the .zip file which is our distribution. -->
-
-<assembly
- xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0
- http://maven.apache.org/xsd/assembly-1.1.0.xsd">
- <id>controller</id>
- <formats>
- <format>zip</format>
- </formats>
-
- <!-- we want "system" and related files right at the root level
- as this file is suppose to be unzip on top of a karaf
- distro. -->
- <includeBaseDirectory>false</includeBaseDirectory>
-
- <fileSets>
- <fileSet>
- <directory>target/assembly/</directory>
- <outputDirectory>.</outputDirectory>
- <excludes>
- </excludes>
- </fileSet>
- </fileSets>
-
-</assembly>
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/main/resources/scripts/install-feature.sh b/appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/main/resources/scripts/install-feature.sh
deleted file mode 100644
index d3596c688..000000000
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-installer/src/main/resources/scripts/install-feature.sh
+++ /dev/null
@@ -1,63 +0,0 @@
-###
-# ============LICENSE_START=======================================================
-# ONAP : APPC
-# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-# ================================================================================
-# Copyright (C) 2017 Amdocs
-# =============================================================================
-# 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.
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-# ============LICENSE_END=========================================================
-###
-
-#!/bin/bash
-
-ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
-ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client}
-ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"}
-INSTALLERDIR=$(dirname $0)
-
-REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip
-
-if [ -f ${REPOZIP} ]
-then
- unzip -n -d ${ODL_HOME} ${REPOZIP}
-else
- echo "ERROR : repo zip ($REPOZIP) not found"
- exit 1
-fi
-
-COUNT=0
-while [ $COUNT -lt 10 ]; do
- ${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} 2> /tmp/installErr
- cat /tmp/installErr
- if grep -q 'Failed to get the session' /tmp/installErr; then
- sleep 10
- else
- let COUNT=10
- fi
- let COUNT=COUNT+1
-done
-COUNT=0
-while [ $COUNT -lt 10 ]; do
- ${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot} 2> /tmp/installErr
- cat /tmp/installErr
- if grep -q 'Failed to get the session' /tmp/installErr; then
- sleep 10
- else
- let COUNT=10
- fi
- let COUNT=COUNT+1
-done
diff --git a/appc-dispatcher/appc-command-executor/pom.xml b/appc-dispatcher/appc-command-executor/pom.xml
index 69cf83900..dde1b7d41 100644
--- a/appc-dispatcher/appc-command-executor/pom.xml
+++ b/appc-dispatcher/appc-command-executor/pom.xml
@@ -1,10 +1,37 @@
-<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">
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APPC
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Copyright (C) 2017 Amdocs
+ =============================================================================
+ 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.
+
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ ============LICENSE_END=========================================================
+ -->
+<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.onap.appc</groupId>
<artifactId>appc-dispatcher</artifactId>
<version>1.3.0-SNAPSHOT</version>
</parent>
+
<artifactId>appc-command-executor</artifactId>
<packaging>pom</packaging>
<name>APPC Command Executor</name>
@@ -17,7 +44,6 @@
<module>appc-command-executor-api</module>
<module>appc-command-executor-core</module>
<module>appc-command-executor-features</module>
- <module>appc-command-executor-installer</module>
</modules>
-</project> \ No newline at end of file
+</project>