aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/so-appc-orchestrator/src/main
diff options
context:
space:
mode:
authorKuleshov, Elena <evn@att.com>2020-01-10 09:53:29 -0500
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-01-10 09:53:30 -0500
commit833d219c3b6689ea27f46719a3a00cbaf7e649fe (patch)
treeec6d72a3b5591843f087012512666a962cfb3b86 /adapters/so-appc-orchestrator/src/main
parent9d77758d706d13c1c2ea46ada1837d757adbf9ba (diff)
1911 create appc adapter micro service
Added new appc adapter micro service. Made required code changes to use the new adapter. Issue-ID: SO-2596 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I880ecace64ec85ca4094a82bc1210798fd3bb85d
Diffstat (limited to 'adapters/so-appc-orchestrator/src/main')
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/AppcOrchestratorApplication.java46
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerCallback.java84
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java244
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerOrchestratorException.java37
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerSupport.java207
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/StatusCategory.java16
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java53
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/Identity.java24
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/Parameters.java99
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/RequestParameters.java59
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTask.java50
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java112
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskService.java31
-rw-r--r--adapters/so-appc-orchestrator/src/main/resources/application.yaml18
14 files changed, 1080 insertions, 0 deletions
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/AppcOrchestratorApplication.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/AppcOrchestratorApplication.java
new file mode 100644
index 0000000000..258c95ac89
--- /dev/null
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/AppcOrchestratorApplication.java
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.appc.orchestrator;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * @since Version 1.0
+ *
+ */
+
+@SpringBootApplication(scanBasePackages = {"org.onap"})
+public class AppcOrchestratorApplication {
+
+ private static final String LOGS_DIR = "logs_dir";
+
+ private static void setLogsDir() {
+ if (System.getProperty(LOGS_DIR) == null) {
+ System.getProperties().setProperty(LOGS_DIR, "./logs/appcorch/");
+ }
+ }
+
+ public static void main(String... args) {
+ SpringApplication.run(AppcOrchestratorApplication.class, args);
+ setLogsDir();
+ }
+}
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerCallback.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerCallback.java
new file mode 100644
index 0000000000..1f73000299
--- /dev/null
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerCallback.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.appc.orchestrator.client;
+
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.appc.client.lcm.api.ResponseHandler;
+import org.onap.appc.client.lcm.exceptions.AppcClientException;
+import org.onap.appc.client.lcm.model.Status;
+import org.onap.so.adapters.appc.orchestrator.client.StatusCategory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ApplicationControllerCallback<T> implements ResponseHandler<T> {
+
+ private static final Logger logger = LoggerFactory.getLogger(ApplicationControllerCallback.class);
+
+ private final ExternalTask externalTask;
+ private final ExternalTaskService externalTaskService;
+ private final ApplicationControllerSupport appCSupport;
+
+ public ApplicationControllerCallback(ExternalTask externalTask, ExternalTaskService externalTaskService,
+ ApplicationControllerSupport appCSupport) {
+ this.externalTask = externalTask;
+ this.externalTaskService = externalTaskService;
+ this.appCSupport = appCSupport;
+ }
+
+ @Override
+ public void onResponse(T response) {
+ logger.info("ON RESPONSE IN CALLBACK");
+
+ Status status = appCSupport.getStatusFromGenericResponse(response);
+
+ logger.info("Status code is: " + status.getCode());
+ logger.info("Status message is: " + status.getMessage());
+
+ if (appCSupport.getFinalityOf(status)) {
+ logger.debug("Obtained final status, complete the task");
+ completeExternalTask(externalTask, externalTaskService, status);
+ } else {
+ logger.debug("Intermediate status, continue the task");
+ }
+ }
+
+ @Override
+ public void onException(AppcClientException exception) {
+
+ logger.info("ON EXCEPTION IN CALLBACK");
+ logger.info("Exception from APPC: " + exception.getMessage());
+ Status exceptionStatus = appCSupport.buildStatusFromAppcException(exception);
+ completeExternalTask(externalTask, externalTaskService, exceptionStatus);
+ }
+
+ private void completeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService,
+ Status status) {
+
+ if (appCSupport.getCategoryOf(status).equals(StatusCategory.NORMAL)) {
+ externalTaskService.complete(externalTask);
+ logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ } else {
+ logger.debug("The External Task Id: {} Failed", externalTask.getId());
+ externalTaskService.handleBpmnError(externalTask, "MSOWorkflowException", status.getMessage());
+ }
+ }
+}
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java
new file mode 100644
index 0000000000..20093be6a4
--- /dev/null
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java
@@ -0,0 +1,244 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.appc.orchestrator.client;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.time.Instant;
+import java.util.Optional;
+import java.util.Properties;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+import org.onap.appc.client.lcm.api.AppcClientServiceFactoryProvider;
+import org.onap.appc.client.lcm.api.AppcLifeCycleManagerServiceFactory;
+import org.onap.appc.client.lcm.api.ApplicationContext;
+import org.onap.appc.client.lcm.api.LifeCycleManagerStateful;
+import org.onap.appc.client.lcm.exceptions.AppcClientException;
+import org.onap.appc.client.lcm.model.Action;
+import org.onap.appc.client.lcm.model.ActionIdentifiers;
+import org.onap.appc.client.lcm.model.CommonHeader;
+import org.onap.appc.client.lcm.model.Flags;
+import org.onap.appc.client.lcm.model.Flags.Force;
+import org.onap.appc.client.lcm.model.Flags.Mode;
+import org.onap.so.adapters.appc.orchestrator.client.ApplicationControllerOrchestratorException;
+import org.onap.so.adapters.appc.orchestrator.client.ApplicationControllerSupport;
+import org.onap.so.adapters.appc.orchestrator.client.StatusCategory;
+import org.onap.appc.client.lcm.model.Payload;
+import org.onap.appc.client.lcm.model.Status;
+import org.onap.appc.client.lcm.model.ZULU;
+
+@Component
+public class ApplicationControllerClient {
+
+ @Autowired
+ public Environment env;
+
+ public static final String DEFAULT_CONTROLLER_TYPE = "APPC";
+
+ private static final String CLIENT_NAME = "MSO";
+
+ private static final String API_VER = "2.00";
+ private static final String ORIGINATOR_ID = "MSO";
+ private static final int FLAGS_TTL = 65000;
+ private static Logger logger = LoggerFactory.getLogger(ApplicationControllerClient.class);
+
+ @Autowired
+ private ApplicationControllerSupport appCSupport;
+
+ // APPC gave us an API where the controllerType is configured in the
+ // client object, which is not what we asked for. We asked for an API
+ // in which the client would have additional methods that could take
+ // the controllerType as a parameter, so that we would not need to
+ // maintain multiple client objects. This map should be removed when
+ // the (hopefully short-term) controllerType becomes obsolete.
+
+ private String controllerType = DEFAULT_CONTROLLER_TYPE;
+
+ private static ConcurrentHashMap<String, LifeCycleManagerStateful> appCClients = new ConcurrentHashMap<>();
+
+ /**
+ * Creates an ApplicationControllerClient for the specified controller type.
+ *
+ * @param controllerType the controller type: "appc" or "sdnc".
+ */
+ public void setControllerType(String controllerType) {
+ if (controllerType == null) {
+ controllerType = DEFAULT_CONTROLLER_TYPE;
+ }
+ this.controllerType = controllerType.toUpperCase();
+ }
+
+ /**
+ * Gets the controller type.
+ *
+ * @return the controllertype
+ */
+ public String getControllerType() {
+ return controllerType;
+ }
+
+ /**
+ * Returns the AppC client object associated with this ApplicationControllerClient. AppC client objects are shared
+ * objects. One is created if it does not exist.
+ *
+ * @return the client object, or null if creation failed
+ */
+ public LifeCycleManagerStateful getAppCClient() {
+ return appCClients.computeIfAbsent(controllerType, k -> createAppCClient(k));
+ }
+
+ protected LifeCycleManagerStateful createAppCClient(String controllerType) {
+
+ try {
+ if (controllerType == null) {
+ controllerType = DEFAULT_CONTROLLER_TYPE;
+ }
+ controllerType = controllerType.toUpperCase();
+ return AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class)
+ .createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties(controllerType));
+ } catch (AppcClientException e) {
+ logger.error("Error in getting LifeCycleManagerStateful: {}", e.getMessage(), e);
+ // This null value will cause NullPointerException when used later.
+ // Error handling could certainly be improved here.
+ return null;
+ }
+ }
+
+ public Status vnfCommand(Action action, String requestId, String vnfId, Optional<String> vserverId,
+ Optional<String> request, String controllerType, ApplicationControllerCallback listener)
+ throws ApplicationControllerOrchestratorException {
+ this.setControllerType(controllerType);
+ Status status;
+ ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
+ actionIdentifiers.setVnfId(vnfId);
+ if (vserverId.isPresent()) {
+ actionIdentifiers.setVserverId(vserverId.get());
+ }
+ Payload payload = null;
+ if (request.isPresent()) {
+ payload = new Payload(request.get());
+
+ }
+ status = runCommand(action, actionIdentifiers, payload, requestId, listener);
+ if (appCSupport.getCategoryOf(status).equals(StatusCategory.ERROR)) {
+ throw new ApplicationControllerOrchestratorException(status.getMessage(), status.getCode());
+ } else {
+ return status;
+ }
+ }
+
+
+ public Status runCommand(Action action, org.onap.appc.client.lcm.model.ActionIdentifiers actionIdentifiers,
+ org.onap.appc.client.lcm.model.Payload payload, String requestID, ApplicationControllerCallback listener)
+ throws ApplicationControllerOrchestratorException {
+ Status status;
+ Object requestObject;
+ requestObject = createRequest(action, actionIdentifiers, payload, requestID);
+ appCSupport.logLCMMessage(requestObject);
+ LifeCycleManagerStateful client = getAppCClient();
+ Method lcmMethod = appCSupport.getAPIMethod(action.name(), client, true);
+ try {
+ Object response = lcmMethod.invoke(client, requestObject, listener);
+ if (response != null) {
+ return appCSupport.getStatusFromGenericResponse(response);
+ } else {
+ return new Status();
+ }
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ throw new RuntimeException(String.format("%s : %s", "Unable to invoke action", action.toString()), e);
+ }
+ }
+
+ protected Properties getLCMProperties() {
+ return getLCMProperties("appc");
+ }
+
+ protected Properties getLCMProperties(String controllerType) {
+ Properties properties = new Properties();
+
+ properties.put("topic.read", this.env.getProperty("appc.client.topic.read.name"));
+ properties.put("topic.write", this.env.getProperty("appc.client.topic.write"));
+ properties.put("SDNC-topic.read", this.env.getProperty("appc.client.topic.sdnc.read"));
+ properties.put("SDNC-topic.write", this.env.getProperty("appc.client.topic.sdnc.write"));
+ properties.put("topic.read.timeout", this.env.getProperty("appc.client.topic.read.timeout"));
+ properties.put("client.response.timeout", this.env.getProperty("appc.client.response.timeout"));
+ properties.put("poolMembers", this.env.getProperty("appc.client.poolMembers"));
+ properties.put("controllerType", controllerType);
+ properties.put("client.key", this.env.getProperty("appc.client.key"));
+ properties.put("client.secret", this.env.getProperty("appc.client.secret"));
+ properties.put("client.name", CLIENT_NAME);
+ properties.put("service", this.env.getProperty("appc.client.service"));
+ return properties;
+ }
+
+ public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId) {
+ Object requestObject = appCSupport.getInput(action.name());
+
+
+ try {
+ CommonHeader commonHeader = buildCommonHeader(requestId);
+ requestObject.getClass().getDeclaredMethod("setCommonHeader", CommonHeader.class).invoke(requestObject,
+ commonHeader);
+ requestObject.getClass().getDeclaredMethod("setAction", Action.class).invoke(requestObject, action);
+ requestObject.getClass().getDeclaredMethod("setActionIdentifiers", ActionIdentifiers.class)
+ .invoke(requestObject, identifier);
+ if (payload != null) {
+ logger.info("payload in RunCommand: " + payload.getValue());
+ requestObject.getClass().getDeclaredMethod("setPayload", Payload.class).invoke(requestObject, payload);
+ }
+ } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
+ logger.error("Error building Appc request", e);
+ }
+ return requestObject;
+ }
+
+ private CommonHeader buildCommonHeader(String requestId) {
+ CommonHeader commonHeader = new CommonHeader();
+ commonHeader.setApiVer(API_VER);
+ commonHeader.setOriginatorId(ORIGINATOR_ID);
+ commonHeader.setRequestId(requestId == null ? UUID.randomUUID().toString() : requestId);
+ commonHeader.setSubRequestId(UUID.randomUUID().toString());
+ Flags flags = new Flags();
+ String flagsMode = "NORMAL";
+ Mode mode = Mode.valueOf(flagsMode);
+ flags.setMode(mode);
+ String flagsForce = "FALSE";
+ Force force = Force.valueOf(flagsForce);
+ flags.setForce(force);
+ flags.setTtl(FLAGS_TTL);
+ commonHeader.setFlags(flags);
+ Instant timestamp = Instant.now();
+ ZULU zulu = new ZULU(timestamp.toString());
+ commonHeader.setTimestamp(zulu);
+ return commonHeader;
+ }
+
+ public Flags createRequestFlags() {
+ Flags flags = new Flags();
+ flags.setTtl(6000);
+ return flags;
+ }
+}
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerOrchestratorException.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerOrchestratorException.java
new file mode 100644
index 0000000000..cc980a489d
--- /dev/null
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerOrchestratorException.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.appc.orchestrator.client;
+
+
+public class ApplicationControllerOrchestratorException extends Exception {
+
+ private static final long serialVersionUID = 2594894543585595494L;
+ private final int appcCode;
+
+ public ApplicationControllerOrchestratorException(String message, int code) {
+ super(message);
+ appcCode = code;
+ }
+
+ public int getAppcCode() {
+ return appcCode;
+ }
+}
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerSupport.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerSupport.java
new file mode 100644
index 0000000000..90ab24cb86
--- /dev/null
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerSupport.java
@@ -0,0 +1,207 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.appc.orchestrator.client;
+
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import org.onap.appc.client.lcm.api.LifeCycleManagerStateful;
+import org.onap.appc.client.lcm.api.ResponseHandler;
+import org.onap.appc.client.lcm.exceptions.AppcClientException;
+import org.onap.appc.client.lcm.model.Status;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectWriter;
+
+
+@Component
+public class ApplicationControllerSupport {
+
+ private static final int ACCEPT_SERIES = 100;
+ private static final int ERROR_SERIES = 200;
+ private static final int REJECT_SERIES = 300;
+ private static final int SUCCESS_SERIES = 400;
+ private static final int SUCCESS_STATUS = SUCCESS_SERIES;
+ private static final int PARTIAL_SERIES = 500;
+ private static final int PARTIAL_SUCCESS_STATUS = PARTIAL_SERIES;
+ private static final int PARTIAL_FAILURE_STATUS = PARTIAL_SERIES + 1;
+
+ private static Logger logger = LoggerFactory.getLogger(ApplicationControllerSupport.class);
+ private String lcmModelPackage = "org.onap.appc.client.lcm.model";
+
+ /**
+ * @param action
+ * @return
+ * @throws ClassNotFoundException
+ * @throws InstantiationException
+ * @throws IllegalAccessException
+ */
+ public Object getInput(String action) {
+ try {
+ return getInputClass(action).newInstance();
+ } catch (IllegalAccessException | InstantiationException e) {
+ throw new RuntimeException(
+ String.format("%s : %s", "Unable to instantiate viable LCM Kit input class for action", action), e);
+ }
+ }
+
+ /**
+ * @param action
+ * @return
+ * @throws ClassNotFoundException
+ */
+ public Method getAPIMethod(String action, LifeCycleManagerStateful lcmStateful, boolean async) {
+ Method[] methods = lcmStateful.getClass().getMethods();
+ for (Method method : methods) {
+ if (method.getName().equalsIgnoreCase(action)) {
+ Class<?>[] methodParameterTypes = method.getParameterTypes();
+ if (methodParameterTypes.length > 0) {
+ if (getInputClass(action).equals(methodParameterTypes[0])) {
+ if (async) {
+ if (methodParameterTypes.length == 2
+ && ResponseHandler.class.isAssignableFrom(methodParameterTypes[1])) {
+ return method;
+ }
+ } else if (methodParameterTypes.length == 1) {
+ return method;
+ }
+ }
+ }
+ }
+ }
+ throw new RuntimeException(String.format("%s : %s, async=%b",
+ "Unable to derive viable LCM Kit API method for action", action, async));
+ }
+
+ public Status getStatusFromGenericResponse(Object response) {
+ Method statusReader = getBeanPropertyMethodFor(response.getClass(), "status", false);
+ if (statusReader != null) {
+ try {
+ return (Status) statusReader.invoke(response);
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ logger.error("Unable to obtain status from LCM Kit response", e);
+ }
+ }
+ return new Status();
+ }
+
+ public StatusCategory getCategoryOf(Status status) {
+ int codeSeries = status.getCode() - (status.getCode() % 100);
+ switch (codeSeries) {
+ case ACCEPT_SERIES:
+ return StatusCategory.NORMAL;
+ case ERROR_SERIES:
+ case REJECT_SERIES:
+ return StatusCategory.ERROR;
+ case SUCCESS_SERIES:
+ return status.getCode() == SUCCESS_STATUS ? StatusCategory.NORMAL : StatusCategory.ERROR;
+ case PARTIAL_SERIES:
+ switch (status.getCode()) {
+ case PARTIAL_SUCCESS_STATUS:
+ return StatusCategory.NORMAL;
+ case PARTIAL_FAILURE_STATUS:
+ return StatusCategory.ERROR;
+ default:
+ return StatusCategory.WARNING;
+ }
+ default:
+ return StatusCategory.WARNING;
+ }
+ }
+
+ public boolean getFinalityOf(Status status) {
+ int codeSeries = status.getCode() - (status.getCode() % 100);
+ switch (codeSeries) {
+ case ACCEPT_SERIES:
+ case PARTIAL_SERIES:
+ return false;
+ case ERROR_SERIES:
+ case REJECT_SERIES:
+ case SUCCESS_SERIES:
+ return true;
+ default:
+ return true;
+ }
+ }
+
+ private Method getBeanPropertyMethodFor(Class<?> clazz, String propertyName, boolean isWriter) {
+ BeanInfo beanInfo;
+ try {
+ beanInfo = Introspector.getBeanInfo(clazz, Object.class);
+ } catch (IntrospectionException e) {
+ throw new RuntimeException(
+ String.format("Unable to produce bean property method for class : %s, property : %s, writer=%b",
+ clazz.getName(), propertyName, isWriter),
+ e);
+ }
+ PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
+ for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
+ if (propertyDescriptor.getName().equals(propertyName)) {
+ return isWriter ? propertyDescriptor.getWriteMethod() : propertyDescriptor.getReadMethod();
+ }
+ }
+ throw new RuntimeException(
+ String.format("Unable to produce bean property method for class : %s, property : %s, writer=%b",
+ clazz.getName(), propertyName, isWriter));
+ }
+
+ /**
+ * @param action
+ * @return
+ * @throws ClassNotFoundException
+ */
+ private Class<?> getInputClass(String action) {
+ try {
+ return Class.forName(lcmModelPackage + '.' + action + "Input");
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(String.format("%s : %s using package : %s",
+ "Unable to identify viable LCM Kit input class for action", action, lcmModelPackage), e);
+ }
+ }
+
+
+ public void logLCMMessage(Object message) {
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper.setSerializationInclusion(Include.NON_NULL);
+ ObjectWriter writer = objectMapper.writerWithDefaultPrettyPrinter();
+ String inputAsJSON;
+ try {
+ inputAsJSON = writer.writeValueAsString(message);
+ logger.info("LCM Kit input message follows: {}", inputAsJSON);
+ } catch (JsonProcessingException e) {
+ logger.error("Error in logging LCM Message", e);
+ }
+ }
+
+ public Status buildStatusFromAppcException(AppcClientException exception) {
+ Status exceptionStatus = new Status();
+ exceptionStatus.setCode(200);
+ exceptionStatus.setMessage("Exception on APPC request: " + exception.getMessage());
+ return exceptionStatus;
+ }
+}
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/StatusCategory.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/StatusCategory.java
new file mode 100644
index 0000000000..27160ef981
--- /dev/null
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/StatusCategory.java
@@ -0,0 +1,16 @@
+package org.onap.so.adapters.appc.orchestrator.client;
+
+public enum StatusCategory {
+ NORMAL("normal"), WARNING("warning"), ERROR("error");
+
+ private final String category;
+
+ private StatusCategory(final String category) {
+ this.category = category;
+ }
+
+ @Override
+ public String toString() {
+ return category;
+ }
+}
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java
new file mode 100644
index 0000000000..b065e9a0c3
--- /dev/null
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java
@@ -0,0 +1,53 @@
+package org.onap.so.adapters.appc.orchestrator.client.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class ConfigurationParameters {
+
+ @JsonProperty("vnf_name")
+ private String vnfName;
+ @JsonProperty("book_name")
+ private String bookName;
+ @JsonProperty("node_list")
+ private String nodeList;
+ @JsonProperty("file_parameter_content")
+ private String fileParameterContent;
+
+
+ @JsonProperty("vnf_name")
+ public String getVnfName() {
+ return vnfName;
+ }
+
+ @JsonProperty("vnf_name")
+ public void setVnfName(String vnfName) {
+ this.vnfName = vnfName;
+ }
+
+ public String getBookName() {
+ return bookName;
+ }
+
+ public void setBookName(String bookName) {
+ this.bookName = bookName;
+ }
+
+ public String getNodeList() {
+ return nodeList;
+ }
+
+ public void setNodeList(String nodeList) {
+ this.nodeList = nodeList;
+ }
+
+ public String getFileParameterContent() {
+ return fileParameterContent;
+ }
+
+ public void setFileParameterContent(String fileParameterContent) {
+ this.fileParameterContent = fileParameterContent;
+ }
+
+}
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/Identity.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/Identity.java
new file mode 100644
index 0000000000..912441ad9a
--- /dev/null
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/Identity.java
@@ -0,0 +1,24 @@
+package org.onap.so.adapters.appc.orchestrator.client.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"identity-url"})
+public class Identity {
+
+ @JsonProperty("identity-url")
+ private String identityUrl;
+
+ @JsonProperty("identity-url")
+ public String getIdentityUrl() {
+ return identityUrl;
+ }
+
+ @JsonProperty("identity-url")
+ public void setIdentityUrl(String identityUrl) {
+ this.identityUrl = identityUrl;
+ }
+
+}
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/Parameters.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/Parameters.java
new file mode 100644
index 0000000000..9b0385bd7a
--- /dev/null
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/Parameters.java
@@ -0,0 +1,99 @@
+package org.onap.so.adapters.appc.orchestrator.client.beans;
+
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"vm-id", "identity-url", "old_software_version", "new_software_version", "operations_timeout",
+ "request-parameters", "configuration-parameters"})
+public class Parameters {
+
+ @JsonProperty("vm-id")
+ private String vmId;
+ @JsonProperty("identity-url")
+ private String identityUrl;
+ @JsonProperty("operations_timeout")
+ private String operationsTimeout;
+ @JsonProperty("existing_software_version")
+ private String existingSoftwareVersion;
+ @JsonProperty("new_software_version")
+ private String newSoftwareVersion;
+ @JsonProperty("request-parameters")
+ private RequestParameters requestParameters;
+ @JsonProperty("configuration-parameters")
+ private ConfigurationParameters configurationParameters;
+
+ @JsonProperty("request-parameters")
+ public RequestParameters getRequestParameters() {
+ return requestParameters;
+ }
+
+ @JsonProperty("request-parameters")
+ public void setRequestParameters(RequestParameters requestParameters) {
+ this.requestParameters = requestParameters;
+ }
+
+ @JsonProperty("configuration-parameters")
+ public ConfigurationParameters getConfigurationParameters() {
+ return configurationParameters;
+ }
+
+ @JsonProperty("configuration-parameters")
+ public void setConfigurationParameters(ConfigurationParameters configurationParameters) {
+ this.configurationParameters = configurationParameters;
+ }
+
+ @JsonProperty("vm-id")
+ public String getVmId() {
+ return vmId;
+ }
+
+ @JsonProperty("vm-id")
+ public void setVmId(String vmId) {
+ this.vmId = vmId;
+ }
+
+ @JsonProperty("identity-url")
+ public String getIdentityUrl() {
+ return identityUrl;
+ }
+
+ @JsonProperty("identity-url")
+ public void setIdentityUrl(String identityUrl) {
+ this.identityUrl = identityUrl;
+ }
+
+ @JsonProperty("operations_timeout")
+ public String getOperationsTimeout() {
+ return operationsTimeout;
+ }
+
+ @JsonProperty("operations_timeout")
+ public void setOperationsTimeout(String operationsTimeout) {
+ this.operationsTimeout = operationsTimeout;
+ }
+
+ @JsonProperty("existing_software_version")
+ public String getExistingSoftwareVersion() {
+ return existingSoftwareVersion;
+ }
+
+ @JsonProperty("existing_software_version")
+ public void setExistingSoftwareVersion(String existingSoftwareVersion) {
+ this.existingSoftwareVersion = existingSoftwareVersion;
+ }
+
+ @JsonProperty("new_software_version")
+ public String getNewSoftwareVersion() {
+ return newSoftwareVersion;
+ }
+
+ @JsonProperty("new_software_version")
+ public void setNewSoftwareVersion(String newSoftwareVersion) {
+ this.newSoftwareVersion = newSoftwareVersion;
+ }
+
+
+}
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/RequestParameters.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/RequestParameters.java
new file mode 100644
index 0000000000..ddc0a0ea3d
--- /dev/null
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/RequestParameters.java
@@ -0,0 +1,59 @@
+package org.onap.so.adapters.appc.orchestrator.client.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class RequestParameters {
+
+ @JsonProperty("vnf-host-ip-address")
+ private String vnfHostIpAddress;
+ @JsonProperty("vf-module-id")
+ private String vfModuleId;
+ @JsonProperty("vnf-name")
+ private String vnfName;
+ @JsonProperty("host-ip-address")
+ private String hostIpAddress;
+
+ public String getVnfHostIpAddress() {
+ return vnfHostIpAddress;
+ }
+
+ public void setVnfHostIpAddress(String vnfHostIpAddress) {
+ this.vnfHostIpAddress = vnfHostIpAddress;
+ }
+
+ public String getVfModuleId() {
+ return vfModuleId;
+ }
+
+ public void setVfModuleId(String vfModuleId) {
+ this.vfModuleId = vfModuleId;
+ }
+
+ public String getVnfName() {
+ return vnfName;
+ }
+
+ public void setVnfName(String vnfName) {
+ this.vnfName = vnfName;
+ }
+
+ public String getHostIpAddress() {
+ return hostIpAddress;
+ }
+
+ public void setHostIpAddress(String hostIpAddress) {
+ this.hostIpAddress = hostIpAddress;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("RequestParametersConfigScaleOut{");
+ sb.append("vnf-host-ip-address=").append(vnfHostIpAddress);
+ sb.append(", vf-module-id='").append(vfModuleId);
+ sb.append('}');
+ return sb.toString();
+ }
+
+}
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTask.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTask.java
new file mode 100644
index 0000000000..181d114cc0
--- /dev/null
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTask.java
@@ -0,0 +1,50 @@
+package org.onap.so.adapters.appc.orchestrator.service;
+
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.so.adapters.appc.orchestrator.client.ApplicationControllerCallback;
+import org.onap.so.adapters.appc.orchestrator.client.ApplicationControllerSupport;
+import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest;
+import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.utils.ExternalTaskUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+import org.onap.appc.client.lcm.model.Status;
+
+@Component
+public class ApplicationControllerTask extends ExternalTaskUtils {
+
+ private static final Logger logger = LoggerFactory.getLogger(ApplicationControllerTask.class);
+
+ @Autowired
+ public Environment env;
+
+ @Autowired
+ public ApplicationControllerTaskImpl applicationControllerTaskImpl;
+
+ @Autowired
+ public ApplicationControllerSupport applicationControllerSupport;
+
+ @Autowired
+ private AuditMDCSetup mdcSetup;
+
+ protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ mdcSetup.setupMDC(externalTask);
+ ApplicationControllerTaskRequest request = externalTask.getVariable("appcOrchestratorRequest");
+ String msoRequestId = externalTask.getVariable("mso-request-id");
+ logger.debug("Starting External Task for RequestId: {} ", msoRequestId);
+ Status status = null;
+ ApplicationControllerCallback listener =
+ new ApplicationControllerCallback(externalTask, externalTaskService, applicationControllerSupport);
+
+ try {
+ status = applicationControllerTaskImpl.execute(msoRequestId, request, listener);
+ } catch (Exception e) {
+ logger.error("Error while calling appc", e.getMessage());
+ }
+ }
+
+}
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
new file mode 100644
index 0000000000..a174ccb05a
--- /dev/null
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
@@ -0,0 +1,112 @@
+package org.onap.so.adapters.appc.orchestrator.service;
+
+import java.util.Optional;
+import org.onap.appc.client.lcm.model.Status;
+import org.onap.so.adapters.appc.orchestrator.client.ApplicationControllerCallback;
+import org.onap.so.adapters.appc.orchestrator.client.ApplicationControllerClient;
+import org.onap.so.adapters.appc.orchestrator.client.ApplicationControllerOrchestratorException;
+import org.onap.so.adapters.appc.orchestrator.client.beans.ConfigurationParameters;
+import org.onap.so.adapters.appc.orchestrator.client.beans.Identity;
+import org.onap.so.adapters.appc.orchestrator.client.beans.Parameters;
+import org.onap.so.adapters.appc.orchestrator.client.beans.RequestParameters;
+import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest;
+import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVm;
+import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.JsonProcessingException;
+
+@Component
+public class ApplicationControllerTaskImpl {
+
+ @Autowired
+ private ApplicationControllerClient appcClient;
+
+ public Status execute(String msoRequestId, ApplicationControllerTaskRequest request,
+ ApplicationControllerCallback listener)
+ throws JsonProcessingException, ApplicationControllerOrchestratorException {
+ Status status = null;
+ GraphInventoryCommonObjectMapperProvider mapper = new GraphInventoryCommonObjectMapperProvider();
+ Optional<String> payload = Optional.empty();
+ String vmId = null;
+ Optional<String> vserverId = Optional.empty();
+ Parameters parameters = new Parameters();
+ ConfigurationParameters configParams = new ConfigurationParameters();
+
+ switch (request.getAction()) {
+ case HealthCheck:
+ RequestParameters requestParams = new RequestParameters();
+ requestParams.setHostIpAddress(request.getApplicationControllerVnf().getVnfHostIpAddress());
+ parameters.setRequestParameters(requestParams);
+ payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
+ break;
+ case ResumeTraffic:
+ configParams.setVnfName(request.getApplicationControllerVnf().getVnfName());
+ parameters.setConfigurationParameters(configParams);
+ payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
+ break;
+ case Start:
+ case Stop:
+ Identity identity = new Identity();
+ identity.setIdentityUrl(request.getIdentityUrl());
+ payload = Optional.of((mapper.getMapper().writeValueAsString(identity)));
+ break;
+ case Unlock:
+ case Lock:
+ break;
+ case QuiesceTraffic:
+ parameters.setOperationsTimeout(request.getOperationsTimeout());
+ payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
+ break;
+ case DistributeTraffic:
+ configParams.setBookName(request.getBookName());
+ configParams.setNodeList(request.getNodeList());
+ configParams.setFileParameterContent(request.getFileParameters());
+ configParams.setVnfName(request.getApplicationControllerVnf().getVnfName());
+ parameters.setConfigurationParameters(configParams);
+ payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
+ break;
+ case DistributeTrafficCheck:
+ configParams.setBookName(request.getBookName());
+ configParams.setNodeList(request.getNodeList());
+ configParams.setFileParameterContent(request.getFileParameters());
+ configParams.setVnfName(request.getApplicationControllerVnf().getVnfName());
+ parameters.setConfigurationParameters(configParams);
+ payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
+ break;
+ case ConfigModify:
+ case ConfigScaleOut:
+ break;
+ case UpgradePreCheck:
+ case UpgradePostCheck:
+ case UpgradeSoftware:
+ case UpgradeBackup:
+ parameters.setExistingSoftwareVersion(request.getExistingSoftwareVersion());
+ parameters.setNewSoftwareVersion(request.getNewSoftwareVersion());
+ payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
+ break;
+ case ActionStatus:
+ break;
+ case Snapshot:
+ ApplicationControllerVm applicationControllerVm =
+ request.getApplicationControllerVnf().getApplicationControllerVm();
+ if (applicationControllerVm != null) {
+ vmId = request.getApplicationControllerVnf().getApplicationControllerVm().getVmId();
+ parameters.setVmId(vmId);
+ payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
+ vserverId = Optional
+ .of(request.getApplicationControllerVnf().getApplicationControllerVm().getVserverId());
+ }
+ default:
+ // errorMessage = "Unable to idenify Action request for AppCClient";
+ break;
+ }
+
+ status = appcClient.vnfCommand(request.getAction(), msoRequestId,
+ request.getApplicationControllerVnf().getVnfId(), vserverId, payload, request.getControllerType(),
+ listener);
+
+ return status;
+ }
+
+}
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskService.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskService.java
new file mode 100644
index 0000000000..2a33124eac
--- /dev/null
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskService.java
@@ -0,0 +1,31 @@
+package org.onap.so.adapters.appc.orchestrator.service;
+
+import javax.annotation.PostConstruct;
+import org.onap.so.utils.ExternalTaskServiceUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Profile;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+@Component
+@Profile("!test")
+public class ApplicationControllerTaskService {
+
+ @Autowired
+ public Environment env;
+
+ @Autowired
+ private ApplicationControllerTask appcOrchestrator;
+
+ @Autowired
+ private ExternalTaskServiceUtils externalTaskServiceUtils;
+
+ @PostConstruct
+ public void appcOrchestrator() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ externalTaskServiceUtils.createExternalTaskClient().subscribe("AppcService").lockDuration(604800000)
+ .handler(appcOrchestrator::executeExternalTask).open();
+ }
+ }
+
+}
diff --git a/adapters/so-appc-orchestrator/src/main/resources/application.yaml b/adapters/so-appc-orchestrator/src/main/resources/application.yaml
new file mode 100644
index 0000000000..c0c5962ea2
--- /dev/null
+++ b/adapters/so-appc-orchestrator/src/main/resources/application.yaml
@@ -0,0 +1,18 @@
+server:
+ port: 8080
+ tomcat:
+ max-threads: 50
+
+#Actuator
+management:
+ endpoints:
+ web:
+ base-path: /manage
+ exposure:
+ include: "*"
+ metrics:
+ se-global-registry: false
+ export:
+ prometheus:
+ enabled: true # Whether exporting of metrics to Prometheus is enabled.
+ step: 1m # Step size (i.e. reporting frequency) to use. \ No newline at end of file