aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/main
diff options
context:
space:
mode:
authoreeginux <henry.xie@est.tech>2019-11-20 13:23:49 +0000
committerXuefeng Xie <henry.xie@est.tech>2020-01-24 10:12:25 +0000
commit8c9f2c73f4366ae42ad7e2c1742885b5ad793360 (patch)
tree7664c0f06c29b67bba254b14873c4d18f20d6b45 /bpmn/so-bpmn-tasks/src/main
parent8d77d8544d88dfb91e9287b1620212cc9821bd54 (diff)
decision point API
ControllerRunnable interface: implemented by controller ControllerContext: Controller Context for controller execution ControllerPreparable interface:used to setup execution context ControllerExecutionBB:controller execution for building block ControllerExecutionDE:controller execution for camunda Skeleton implementation for APPC controller Skeleton implementation for SDNC controller Use ControllerExecutionDE for existing PNF configuration. Add integration tests for controllerExecutionBB/DE Add GenericControllerExecution activity for BuildingBlockExecution based Add GenericControllerExecutionDE activity for DelegateExecution based. CDS controller to be implemented by SO-CDS generic buildingBlock Actor seletion based on ingested metadata Issue-ID: SO-2070 Change-Id: I4020c2ce21468939690e2cef78bbadbfff4bd3e4 Signed-off-by: eeginux<henry.xie@est.tech>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/AbstractControllerExecution.java174
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java152
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/LcmControllerBB.java68
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/appc/AppcControllerBB.java66
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/SdncControllerBB.java73
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/prepare/PrepareSdncBB.java47
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/prepare/PrepareSdncUpgradePreCheckPnfBB.java60
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/ControllerExecutionDE.java148
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/LcmControllerDE.java69
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/appc/AppcControllerDE.java62
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/CdsControllerDE.java61
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/prepare/PreparePnfConfigAssignDE.java50
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/prepare/PreparePnfConfigDeployDE.java50
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java62
14 files changed, 1142 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/AbstractControllerExecution.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/AbstractControllerExecution.java
new file mode 100644
index 0000000000..f3b767a8f1
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/AbstractControllerExecution.java
@@ -0,0 +1,174 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.decisionpoint.impl;
+
+import com.google.common.base.Strings;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * Abstract class of the controller execution, it should be extended for the controller execution task.
+ *
+ * @param <T> execution context type, e.g., BuildingBlockExecution or DelegateExecution
+ */
+public abstract class AbstractControllerExecution<T> {
+
+ /**
+ * parameters from the execution context.
+ */
+ protected static final String CONTROLLER_ACTOR_PARAM = "actor";
+ protected static final String CONTROLLER_ACTION_PARAM = "action";
+ protected static final String CONTROLLER_SCOPE_PARAM = "scope";
+ protected static final String RESOURCE_CUSTOMIZATION_UUID_PARAM = "resource_customization_uuid";
+ protected static final String RESOURCE_TYPE_PARAM = "resource_type";
+
+ protected final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+ @Autowired
+ protected List<ControllerRunnable<T>> availableControllerRunnables;
+
+ @Autowired
+ protected ExceptionBuilder exceptionBuilder;
+
+ /**
+ * Find the {@ref ControllerRunnable} instances understanding the {@ref ControllerContext}.
+ *
+ * Only one instance should be able to understand the context. if more than one or none instances found, return
+ * null.
+ *
+ * @param context controller context
+ * @return Optional of ControllerRunnable instance
+ */
+ protected Optional<ControllerRunnable> getController(ControllerContext<T> context) {
+ List<ControllerRunnable<T>> satisfiedControllers = availableControllerRunnables.stream()
+ .filter(controllerRunnable -> controllerRunnable.understand(context)).collect(Collectors.toList());
+
+ if (logger.isDebugEnabled()) {
+ for (ControllerRunnable<T> satisfiedController : satisfiedControllers) {
+ logger.debug("{} controllerRunnable understands the context", satisfiedController.getClass().getName());
+ }
+ }
+
+ /**
+ * Make sure only one {@ref ControllerRunnable} instance understands the context or else return Null.
+ */
+ if (satisfiedControllers.size() == 1) {
+ return Optional.of(satisfiedControllers.get(0));
+ } else if (satisfiedControllers.isEmpty()) {
+ logger.warn("Can NOT find any ControllerRunnable for context: {}", context);
+ } else if (satisfiedControllers.size() > 1) {
+ logger.warn(
+ "Found {} instances understanding the context: {}, please make sure only 1 instance understands it",
+ satisfiedControllers.size(), context);
+ }
+
+ return Optional.empty();
+ }
+
+ /**
+ * Build the {@ref ControllerContext} context based on execution context.
+ *
+ * @param t execution context instance, e.g., BuildingBlockExecution or DelegateExecution instance
+ * @return controller context instance of the execution context type
+ */
+ protected ControllerContext<T> buildControllerContext(final T t) {
+ String controllerAction = getParameterFromExecution(t, CONTROLLER_ACTION_PARAM);
+ String controllerScope = getParameterFromExecution(t, CONTROLLER_SCOPE_PARAM);
+ String resourceCustomizationUuid = getParameterFromExecution(t, RESOURCE_CUSTOMIZATION_UUID_PARAM);
+ String controllerActor = getControllerActor(t, controllerScope, resourceCustomizationUuid, controllerAction);
+ ControllerContext<T> controllerContext = new ControllerContext<>();
+ controllerContext.setExecution(t);
+ controllerContext.setControllerAction(controllerAction);
+ controllerContext.setControllerActor(controllerActor);
+ controllerContext.setControllerScope(controllerScope);
+ return controllerContext;
+ }
+
+ /**
+ * Retrieve the controller actor.
+ *
+ * @param t execution context instance, e.g., BuildingBlockExecution or DelegateExecution instance
+ * @param controllerScope controller scope, e.g, pnf, vnf, vfModule
+ * @param resourceCustomizationUuid resource customization UUID, e.g, pnfCustomizationUuid, vnfCustomizationUuid
+ * @param controllerAction controller action, e.g, configAssign, configDeploy
+ * @return controller actor
+ */
+ protected abstract String getControllerActor(T t, String controllerScope, String resourceCustomizationUuid,
+ String controllerAction);
+
+ /**
+ * Controller execution based on the Controller Context.
+ *
+ * @param controllerContext ControllerContext object
+ */
+ public abstract void controllerExecute(final ControllerContext<T> controllerContext);
+
+ /**
+ * Retrieve the parameter value as String from the execution context.
+ *
+ * @param t execution context instance, e.g., BuildingBlockExecution or DelegateExecution instance
+ * @param parameterName parameter name to be retrieved
+ * @return String value of the parameter
+ */
+ protected abstract String getParameterFromExecution(final T t, String parameterName);
+
+ /**
+ * Check whether the controller actor value is SO ref value, i.e, equals to SO-REF-DATA.
+ *
+ * @param controllerActor controller actor, e.g, SO-REF-DATA, SDNC, CDS
+ * @return true if the controller actor is SO-REF-DATA, else return false
+ */
+ protected boolean isSoRefControllerActor(final String controllerActor) {
+ return !Strings.isNullOrEmpty(controllerActor) && controllerActor.equalsIgnoreCase("SO-REF-DATA");
+ }
+
+ /**
+ * Check whether the controller scope is PNF resource related.
+ *
+ * @param controllerScope controller scope, e.g, pnf, vnf, vfModule
+ * @return true if the controller scope is pnf, else return false
+ */
+ protected boolean isPnfResourceScope(final String controllerScope) {
+ return ("pnf").equalsIgnoreCase(controllerScope);
+ }
+
+ /**
+ * Check whether the controller scope is VNF resource related.
+ *
+ * @param controllerScope controller scope, e.g, pnf, vnf, vfModule
+ * @return true if the controller scope is vnf or vfModule, else return false
+ */
+ protected boolean isVnfResourceScope(final String controllerScope) {
+ if (Strings.isNullOrEmpty(controllerScope)) {
+ return false;
+ }
+ if (controllerScope.toLowerCase().startsWith("vnf") || controllerScope.equalsIgnoreCase("vfmodule")) {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java
new file mode 100644
index 0000000000..39a695b0b6
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java
@@ -0,0 +1,152 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.decisionpoint.impl.buildingblock;
+
+import com.google.common.base.Strings;
+import java.util.Optional;
+import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable;
+import org.onap.so.bpmn.infrastructure.decisionpoint.impl.AbstractControllerExecution;
+import org.onap.so.db.catalog.beans.ControllerSelectionReference;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * This class is used for {@ref BuildingBlockExecution} API based execution.
+ *
+ * it decides which controller implementation to use based on the parameters, like actor, scope, action.
+ *
+ * The following parameters are expected in the {@ref BuildingBlockExecution} context,
+ * <ul>
+ * <li>action: action to be executed</li>
+ * <li>scope: type of the resource, i.e, pnf, vnf, vf</li>
+ * <li>resource_customization_uuid: resource customization UUID</li>
+ * <li>resource_type: resource type, optional. It's used to find the controller from controller_selection_reference
+ * table. Same as VNF_TYPE in the table</li>
+ * </ul>
+ */
+@Component
+public class ControllerExecutionBB extends AbstractControllerExecution<BuildingBlockExecution> {
+
+ @Autowired
+ protected CatalogDbClient catalogDbClient;
+
+ public void execute(final BuildingBlockExecution execution) {
+ ControllerContext<BuildingBlockExecution> controllerContext = buildControllerContext(execution);
+ controllerExecute(controllerContext);
+ }
+
+ @Override
+ protected String getParameterFromExecution(BuildingBlockExecution execution, String parameterName) {
+ Object object = execution.getVariable(parameterName);
+ if (object != null) {
+ String paramValue = String.valueOf(object);
+ logger.debug("parameterName: {}, parameterValue: {}", parameterName, paramValue);
+ return paramValue;
+ }
+ return "";
+ }
+
+ /**
+ * this method is used to get the controller actor, there could be few places to get the actor(ordered by priority),
+ *
+ * <ol>
+ * <li>Execution Context, i.e, BuildingBlockExecution</li>
+ * <li>Resource customization table, pnf_resource_customization for PNF or vnf_resource_customization for VNF</li>
+ * <li>controller_selection_reference, resource_type and action will be used to fetch from this table</li>
+ * </ol>
+ *
+ * @param execution BuildingBlockExecution instance
+ * @param controllerScope controller scope, e.g, pnf, vnf, vfModule
+ * @param resourceCustomizationUuid resource customization UUID, e.g, pnfCustomizationUuid, vnfCustomizationUuid
+ * @param controllerAction controller action, e.g, configAssign, configDeploy
+ * @return controller actor name
+ */
+ @Override
+ protected String getControllerActor(BuildingBlockExecution execution, String controllerScope,
+ String resourceCustomizationUuid, String controllerAction) {
+
+ /**
+ * Firstly, check the execution context for actor parameter.
+ */
+ String controllerActor = getParameterFromExecution(execution, CONTROLLER_ACTOR_PARAM);
+
+ /**
+ * If no meaningful controller actor value found in the execution context and the value is not SO-REF-DATA.
+ */
+ if (Strings.isNullOrEmpty(controllerActor) && !isSoRefControllerActor(controllerActor)) {
+
+ /**
+ * For BuildingBlockExecution, we should try to get the resource information from Cached metadata.
+ *
+ * As the current cached metadata doesn't support controller actor, we use the
+ * {@link org.onap.so.db.catalog.client.CatalogDbClient} to fetch information. Once the change is done in
+ * cached metadata, this part should be refactored as well.
+ */
+ if (isPnfResourceScope(controllerScope)) {
+ PnfResourceCustomization pnfResourceCustomization =
+ catalogDbClient.getPnfResourceCustomizationByModelCustomizationUUID(resourceCustomizationUuid);
+ controllerActor = pnfResourceCustomization.getControllerActor();
+ } else if (isVnfResourceScope(controllerScope)) {
+ VnfResourceCustomization vnfResourceCustomization =
+ catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(resourceCustomizationUuid);
+ controllerActor = vnfResourceCustomization.getControllerActor();
+ } else {
+ logger.warn("Unrecognized scope: {}", controllerScope);
+ }
+ }
+
+ /**
+ * Lastly, can NOT find the controller actor information from resource customization table or the return value
+ * is SO-REF-DATA.
+ */
+ if (Strings.isNullOrEmpty(controllerActor) || isSoRefControllerActor(controllerActor)) {
+ String resourceType = getParameterFromExecution(execution, RESOURCE_TYPE_PARAM);
+ ControllerSelectionReference reference = catalogDbClient
+ .getControllerSelectionReferenceByVnfTypeAndActionCategory(resourceType, controllerAction);
+
+ controllerActor = reference.getControllerName();
+ }
+ return controllerActor;
+ }
+
+ @Override
+ public void controllerExecute(ControllerContext<BuildingBlockExecution> controllerContext) {
+ Optional<ControllerRunnable> optional = getController(controllerContext);
+ if (optional.isPresent()) {
+ ControllerRunnable controller = optional.get();
+ if (controller.ready(controllerContext)) {
+ controller.prepare(controllerContext);
+ controller.run(controllerContext);
+ } else {
+ exceptionBuilder.buildAndThrowWorkflowException(controllerContext.getExecution(), 9001,
+ "Controller is NOT Ready for the action", ONAPComponents.SO);
+ }
+ } else {
+ exceptionBuilder.buildAndThrowWorkflowException(controllerContext.getExecution(), 9000,
+ "Unable to find the controller implementation", ONAPComponents.SO);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/LcmControllerBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/LcmControllerBB.java
new file mode 100644
index 0000000000..d7f6808b75
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/LcmControllerBB.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.decisionpoint.impl.buildingblock.controller;
+
+import java.util.List;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.controller.ControllerPreparable;
+import org.onap.so.client.appc.ApplicationControllerAction;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * This class should be extended by LCM api based controllers.
+ */
+public abstract class LcmControllerBB implements ControllerRunnable<BuildingBlockExecution> {
+
+ protected Logger logger = LoggerFactory.getLogger(this.getClass());
+
+ @Autowired
+ protected ExceptionBuilder exceptionUtil;
+
+ @Autowired(required = false)
+ protected List<ControllerPreparable<BuildingBlockExecution>> prepareList;
+
+ @Autowired
+ protected ApplicationControllerAction client;
+
+ @Override
+ public void prepare(ControllerContext<BuildingBlockExecution> context) {
+ prepareList.stream().filter(prepare -> prepare.understand(context))
+ .forEach(prepare -> prepare.prepare(context));
+ }
+
+ @Override
+ public void run(ControllerContext<BuildingBlockExecution> context) {
+ callLcmClient(context);
+ }
+
+ /**
+ * This method is used to execute the LCM action by calling LCM client, appc Client or SDNC client.
+ *
+ * @return error code
+ */
+ protected abstract int callLcmClient(ControllerContext<BuildingBlockExecution> context);
+
+ protected abstract int getErrorCode();
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/appc/AppcControllerBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/appc/AppcControllerBB.java
new file mode 100644
index 0000000000..8650994da6
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/appc/AppcControllerBB.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.decisionpoint.impl.buildingblock.controller.appc;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable;
+import org.onap.so.bpmn.infrastructure.decisionpoint.impl.buildingblock.controller.LcmControllerBB;
+import org.onap.so.client.appc.ApplicationControllerAction;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * This implementation of {@link ControllerRunnable} is created to demonstrate how to support Appc based controller.
+ */
+@Component
+public class AppcControllerBB extends LcmControllerBB {
+
+ private static final int APPC_ERROR_CODE = 1002;
+
+ @Autowired
+ private ApplicationControllerAction client;
+
+ @Override
+ public Boolean understand(ControllerContext<BuildingBlockExecution> context) {
+ return context.getControllerActor().equalsIgnoreCase("appc");
+ }
+
+ @Override
+ public Boolean ready(ControllerContext<BuildingBlockExecution> context) {
+ return true;
+ }
+
+ /**
+ * This method is left empty intentionally. If you are planning to use the Appc Controller, please implement here.
+ *
+ * You can use the {@ref ApplicationControllerAction}, {@ref ApplicationControllerOrchestrator},
+ * {@ref ApplicationControllerClient} or create your own Appc Client proxy.
+ */
+ @Override
+ protected int callLcmClient(ControllerContext<BuildingBlockExecution> context) {
+ return 0;
+ }
+
+ @Override
+ protected int getErrorCode() {
+ return APPC_ERROR_CODE;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/SdncControllerBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/SdncControllerBB.java
new file mode 100644
index 0000000000..6baf881be8
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/SdncControllerBB.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.decisionpoint.impl.buildingblock.controller.sdnc;
+
+import java.util.Arrays;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable;
+import org.onap.so.bpmn.infrastructure.decisionpoint.impl.buildingblock.controller.LcmControllerBB;
+import org.springframework.stereotype.Component;
+
+/**
+ * This implementation of {@link ControllerRunnable} is created to demonstrate how to support SDNC based controller.
+ *
+ * For demo purpose, the following actions are supported, UpgradePreCheck UpgradeSoftware UpgradePostCheck, all of these
+ * actions are appc based actions and they need to be refactored to proper SDNC LCM actions.
+ */
+@Component
+public class SdncControllerBB extends LcmControllerBB {
+
+ private static final String[] supportedActions = new String[] {};
+
+ private static final int SDNC_ERROR_CODE = 1002;
+
+ @Override
+ public Boolean understand(ControllerContext<BuildingBlockExecution> context) {
+ return context.getControllerActor().equalsIgnoreCase("sdnc");
+ }
+
+ private boolean isActionSupported(ControllerContext<BuildingBlockExecution> context) {
+ return Arrays.stream(supportedActions).anyMatch(action -> action.equals(context.getControllerAction()));
+ }
+
+ @Override
+ public Boolean ready(ControllerContext<BuildingBlockExecution> context) {
+ return true;
+ }
+
+ /**
+ * This method is left empty intentionally. If you are planning to use the SDNC Controller, please implement here.
+ *
+ * You can use the Appc Client proxy, like, {@ref ApplicationControllerAction}
+ * {@ref ApplicationControllerOrchestrator} {@ref ApplicationControllerClient}
+ *
+ * Or create your own SDNC Client proxy.
+ */
+ @Override
+ protected int callLcmClient(ControllerContext<BuildingBlockExecution> context) {
+ return 0;
+ }
+
+ @Override
+ protected int getErrorCode() {
+ return SDNC_ERROR_CODE;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/prepare/PrepareSdncBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/prepare/PrepareSdncBB.java
new file mode 100644
index 0000000000..dd75107b73
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/prepare/PrepareSdncBB.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.decisionpoint.impl.buildingblock.controller.sdnc.prepare;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.controller.ControllerPreparable;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * This abstract class should be extended by all the SDNC based {@ControllerPreparable}. It defines some common
+ * behavior.
+ */
+public abstract class PrepareSdncBB implements ControllerPreparable<BuildingBlockExecution> {
+
+ protected Logger logger = LoggerFactory.getLogger(this.getClass());
+
+ @Autowired
+ protected ExceptionBuilder exceptionUtil;
+
+ @Autowired
+ protected ExtractPojosForBB extractPojosForBB;
+
+ public boolean understand(final ControllerContext<BuildingBlockExecution> controllerContext) {
+ return controllerContext.getControllerActor().equalsIgnoreCase("sdnc");
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/prepare/PrepareSdncUpgradePreCheckPnfBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/prepare/PrepareSdncUpgradePreCheckPnfBB.java
new file mode 100644
index 0000000000..c659290f28
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/prepare/PrepareSdncUpgradePreCheckPnfBB.java
@@ -0,0 +1,60 @@
+/*
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * ================================================================================ 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.decisionpoint.impl.buildingblock.controller.sdnc.prepare;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.springframework.stereotype.Component;
+
+/**
+ * This class is used to prepare the {@ref ControllerContext} for SDNC UpgradePreCheck action.
+ */
+@Component
+public class PrepareSdncUpgradePreCheckPnfBB extends PrepareSdncBB {
+
+ @Override
+ public boolean understand(ControllerContext<BuildingBlockExecution> controllerContext) {
+ return super.understand(controllerContext) && controllerContext.getControllerAction().equals("UpgradePreCheck")
+ && controllerContext.getControllerScope().equalsIgnoreCase("pnf");
+ }
+
+ @Override
+ public void prepare(ControllerContext<BuildingBlockExecution> controllerContext) {
+
+ String payload = controllerContext.getExecution().getVariable("payload");
+ String actualPayLoad = constructPayload(payload, controllerContext.getControllerAction());
+
+ controllerContext.getExecution().setVariable("payload", actualPayLoad);
+ }
+
+ private String constructPayload(String payload, String action) {
+
+ JSONObject jsonObject = new JSONObject(payload);
+ if (jsonObject.has("action")) {
+ JSONArray jsonArray = jsonObject.getJSONArray("action");
+
+ for (int i = 0; i < jsonArray.length(); i++) {
+ JSONObject jsonObject1 = jsonArray.getJSONObject(i);
+ if (jsonObject1.has(action)) {
+ return jsonObject1.toString();
+ }
+ }
+ }
+ return payload;
+ }
+}
+
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/ControllerExecutionDE.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/ControllerExecutionDE.java
new file mode 100644
index 0000000000..0458d3c103
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/ControllerExecutionDE.java
@@ -0,0 +1,148 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda;
+
+import com.google.common.base.Strings;
+import java.util.Optional;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable;
+import org.onap.so.bpmn.infrastructure.decisionpoint.impl.AbstractControllerExecution;
+import org.onap.so.db.catalog.beans.ControllerSelectionReference;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * This class is used for camunda {@ref DelegateExecution} API based controller execution.
+ *
+ * The following parameters are expected in the {@ref DelegateExecution} context,
+ *
+ * <ul>
+ * <li>action: action to be executed</li>
+ * <li>scope: type of the resource, i.e, pnf, vnf, vf</li>
+ * <li>resource_customization_uuid: resource customization UUID</li>
+ * <li>resource_type: resource type, optional. It's used to find the controller from controller_selection_reference
+ * table. Same as VNF_TYPE in the table</li>
+ * </ul>
+ */
+@Component
+public class ControllerExecutionDE extends AbstractControllerExecution<DelegateExecution> implements JavaDelegate {
+
+ @Autowired
+ protected CatalogDbClient catalogDbClient;
+
+ @Override
+ public void execute(final DelegateExecution execution) {
+ ControllerContext<DelegateExecution> controllerContext = buildControllerContext(execution);
+ controllerExecute(controllerContext);
+ }
+
+ /**
+ * this method is used to get the controller actor, there could be few places to get the actor(ordered by priority),
+ *
+ * <ol>
+ * <li>Execution Context, i.e, DelegateExecution</li>
+ * <li>Resource customization table, pnf_resource_customization for PNF or vnf_resource_customization for VNF</li>
+ * <li>controller_selection_reference, resource_type and action will be used to fetch from this table</li>
+ * </ol>
+ *
+ * @param execution DelegateExecution instance
+ * @param controllerScope controller scope, e.g, pnf, vnf, vfModule
+ * @param resourceCustomizationUuid resource customization UUID, e.g, pnfCustomizationUuid, vnfCustomizationUuid
+ * @param controllerAction controller action, e.g, configAssign, configDeploy
+ * @return controller actor
+ */
+ protected String getControllerActor(DelegateExecution execution, String controllerScope,
+ String resourceCustomizationUuid, String controllerAction) {
+
+ /**
+ * Firstly, check the execution context for actor parameter.
+ */
+ String controllerActor = getParameterFromExecution(execution, CONTROLLER_ACTOR_PARAM);
+
+ /**
+ * If no meaningful controller actor value found in the execution context and the value is not SO-REF-DATA.
+ */
+ if (Strings.isNullOrEmpty(controllerActor) && !isSoRefControllerActor(controllerActor)) {
+
+ /**
+ * secondly, if no meaningful actor from execution context, getting from resource table in database.
+ */
+ if (isPnfResourceScope(controllerScope)) {
+ PnfResourceCustomization pnfResourceCustomization =
+ catalogDbClient.getPnfResourceCustomizationByModelCustomizationUUID(resourceCustomizationUuid);
+ controllerActor = pnfResourceCustomization.getControllerActor();
+ } else if (isVnfResourceScope(controllerScope)) {
+ VnfResourceCustomization vnfResourceCustomization =
+ catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(resourceCustomizationUuid);
+ controllerActor = vnfResourceCustomization.getControllerActor();
+ } else {
+ logger.warn("Unrecognized scope: {}", controllerScope);
+ }
+ }
+
+ /**
+ * Lastly, can NOT find the controller actor information from resource customization table or value is
+ * SO-REF-DATA
+ */
+ if (Strings.isNullOrEmpty(controllerActor) || isSoRefControllerActor(controllerActor)) {
+ String resourceType = getParameterFromExecution(execution, RESOURCE_TYPE_PARAM);
+ ControllerSelectionReference reference = catalogDbClient
+ .getControllerSelectionReferenceByVnfTypeAndActionCategory(resourceType, controllerAction);
+ controllerActor = reference.getControllerName();
+ }
+
+ return controllerActor;
+ }
+
+ @Override
+ public void controllerExecute(ControllerContext<DelegateExecution> controllerContext) {
+ Optional<ControllerRunnable> optional = getController(controllerContext);
+
+ if (optional.isPresent()) {
+ ControllerRunnable controller = optional.get();
+ if (controller.ready(controllerContext)) {
+ controller.prepare(controllerContext);
+ controller.run(controllerContext);
+ } else {
+ exceptionBuilder.buildAndThrowWorkflowException(controllerContext.getExecution(), 9001,
+ "Controller is NOT Ready for the action", ONAPComponents.SO);
+ }
+ } else {
+ exceptionBuilder.buildAndThrowWorkflowException(controllerContext.getExecution(), 9000,
+ "Unable to find the controller implementation", ONAPComponents.SO);
+ }
+ }
+
+ @Override
+ protected String getParameterFromExecution(DelegateExecution execution, String parameterName) {
+ if (execution.hasVariable(parameterName)) {
+ String paramValue = String.valueOf(execution.getVariable(parameterName));
+ logger.debug("parameterName: {}, parameterValue: {}", parameterName, paramValue);
+ return paramValue;
+ } else {
+ return "";
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/LcmControllerDE.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/LcmControllerDE.java
new file mode 100644
index 0000000000..95e270a071
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/LcmControllerDE.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller;
+
+import java.util.List;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.controller.ControllerPreparable;
+import org.onap.so.client.appc.ApplicationControllerAction;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * This abstract class implements {@link ControllerRunnable} used for {@link DelegateExecution} API based LCM
+ * controller.
+ */
+public abstract class LcmControllerDE implements ControllerRunnable<DelegateExecution> {
+
+ protected final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+ @Autowired
+ protected ExceptionBuilder exceptionUtil;
+
+ @Autowired
+ protected List<ControllerPreparable<DelegateExecution>> prepareList;
+
+ @Autowired
+ protected ApplicationControllerAction client;
+
+ @Override
+ public void prepare(ControllerContext<DelegateExecution> context) {
+ prepareList.stream().filter(prepare -> prepare.understand(context))
+ .forEach(prepare -> prepare.prepare(context));
+ }
+
+ @Override
+ public void run(ControllerContext<DelegateExecution> context) {
+ callLcmClient(context);
+ }
+
+ /**
+ * This method is used to execute the LCM action by calling LCM client, appc Client or SDNC client.
+ *
+ * @return error code
+ */
+ protected abstract int callLcmClient(ControllerContext<DelegateExecution> context);
+
+ protected abstract int getErrorCode();
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/appc/AppcControllerDE.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/appc/AppcControllerDE.java
new file mode 100644
index 0000000000..7ebd16e561
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/appc/AppcControllerDE.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.appc;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.LcmControllerDE;
+import org.springframework.stereotype.Component;
+
+/**
+ * This class is created to demonstrate how to support {@link DelegateExecution} API based APPC controller.
+ *
+ * Function wise, it's similar as {@ref AppcClient} groovy code.
+ */
+@Component
+public class AppcControllerDE extends LcmControllerDE {
+
+ private static final int APPC_DELEGATE_EXECUTION_ERROR_CODE = 1102;
+
+ @Override
+ public Boolean understand(ControllerContext<DelegateExecution> context) {
+ return context.getControllerActor().equalsIgnoreCase("appc");
+ }
+
+ @Override
+ public Boolean ready(ControllerContext<DelegateExecution> context) {
+ return true;
+ }
+
+ /**
+ * This method is left empty intentionally. If you are planning to use the Appc Controller, please implement here.
+ *
+ * You can use the {@ref ApplicationControllerAction}, {@ref ApplicationControllerOrchestrator},
+ * {@ref ApplicationControllerClient} or create your own Appc Client proxy.
+ */
+ @Override
+ protected int callLcmClient(ControllerContext<DelegateExecution> context) {
+ return 0;
+ }
+
+ @Override
+ protected int getErrorCode() {
+ return APPC_DELEGATE_EXECUTION_ERROR_CODE;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/CdsControllerDE.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/CdsControllerDE.java
new file mode 100644
index 0000000000..6b0cbc0396
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/CdsControllerDE.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.cds;
+
+import java.util.List;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.controller.ControllerPreparable;
+import org.onap.so.client.cds.AbstractCDSProcessingBBUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * This implementation of {@ref ControllerRunnable} is used for Self service, i.e, blueprint based Controller.
+ */
+@Component
+public class CdsControllerDE extends AbstractCDSProcessingBBUtils implements ControllerRunnable<DelegateExecution> {
+
+ @Autowired(required = false)
+ private List<ControllerPreparable<DelegateExecution>> prepareList;
+
+ @Override
+ public Boolean understand(ControllerContext<DelegateExecution> context) {
+ return context.getControllerActor().equalsIgnoreCase("cds");
+ }
+
+ @Override
+ public Boolean ready(ControllerContext<DelegateExecution> context) {
+ return true;
+ }
+
+ @Override
+ public void prepare(ControllerContext<DelegateExecution> context) {
+ prepareList.stream().filter(prepare -> prepare.understand(context))
+ .forEach(prepare -> prepare.prepare(context));
+ }
+
+ @Override
+ public void run(ControllerContext<DelegateExecution> context) {
+ DelegateExecution execution = context.getExecution();
+ constructExecutionServiceInputObject(execution);
+ sendRequestToCDSClient(execution);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/prepare/PreparePnfConfigAssignDE.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/prepare/PreparePnfConfigAssignDE.java
new file mode 100644
index 0000000000..b0da075e7e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/prepare/PreparePnfConfigAssignDE.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.cds.prepare;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.controller.ControllerPreparable;
+import org.onap.so.bpmn.infrastructure.pnf.delegate.PrepareConfigAssignDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * This class implements {@link ControllerPreparable} interface and is used to set up the context for PNF config-assign
+ * action.
+ */
+@Component
+public class PreparePnfConfigAssignDE implements ControllerPreparable<DelegateExecution> {
+
+ @Autowired
+ private PrepareConfigAssignDelegate prepareConfigAssignDelegate;
+
+ @Override
+ public boolean understand(ControllerContext<DelegateExecution> controllerContext) {
+ return controllerContext.getControllerActor().equalsIgnoreCase("cds")
+ && controllerContext.getControllerAction().equalsIgnoreCase("config-assign")
+ && controllerContext.getControllerScope().equalsIgnoreCase("pnf");
+ }
+
+ @Override
+ public void prepare(ControllerContext<DelegateExecution> controllerContext) {
+ prepareConfigAssignDelegate.execute(controllerContext.getExecution());
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/prepare/PreparePnfConfigDeployDE.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/prepare/PreparePnfConfigDeployDE.java
new file mode 100644
index 0000000000..b88da2ed39
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/prepare/PreparePnfConfigDeployDE.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.cds.prepare;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.controller.ControllerPreparable;
+import org.onap.so.bpmn.infrastructure.pnf.delegate.PrepareConfigDeployDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * This class implements {@link ControllerPreparable} interface and is used to set up the context for PNF config-deploy
+ * action.
+ */
+@Component
+public class PreparePnfConfigDeployDE implements ControllerPreparable<DelegateExecution> {
+
+ @Autowired
+ private PrepareConfigDeployDelegate prepareConfigDeployDelegate;
+
+ @Override
+ public boolean understand(ControllerContext<DelegateExecution> controllerContext) {
+ return controllerContext.getControllerActor().equalsIgnoreCase("cds")
+ && controllerContext.getControllerAction().equalsIgnoreCase("config-deploy")
+ && controllerContext.getControllerScope().equalsIgnoreCase("pnf");
+ }
+
+ @Override
+ public void prepare(ControllerContext<DelegateExecution> controllerContext) {
+ prepareConfigDeployDelegate.execute(controllerContext.getExecution());
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java
new file mode 100644
index 0000000000..db0d402f6e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.sdnc;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.LcmControllerDE;
+import org.springframework.stereotype.Component;
+
+/**
+ * This class is created to demonstrate how to support {@link DelegateExecution} API based SDNC controller.
+ *
+ * Function wise, it's similar to the Appc Controller, like in the AppcClient groovy code.
+ */
+@Component
+public class SdncControllerDE extends LcmControllerDE {
+
+ private static final int SDNC_DELEGATE_EXECUTION_ERROR_CODE = 1103;
+
+ @Override
+ public Boolean understand(ControllerContext<DelegateExecution> context) {
+ return context.getControllerActor().equalsIgnoreCase("sdnc");
+ }
+
+ @Override
+ public Boolean ready(ControllerContext<DelegateExecution> context) {
+ return true;
+ }
+
+ /**
+ * This method is left empty intentionally. If you are planning to use the SDNC Controller, please implement here.
+ *
+ * You can use the {@ref ApplicationControllerAction}, {@ref ApplicationControllerOrchestrator},
+ * {@ref ApplicationControllerClient} or create your own SDNC Client proxy.
+ */
+ @Override
+ protected int callLcmClient(ControllerContext<DelegateExecution> context) {
+ return 0;
+ }
+
+ @Override
+ protected int getErrorCode() {
+ return SDNC_DELEGATE_EXECUTION_ERROR_CODE;
+ }
+}