summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks/src')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java142
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java106
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java44
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java31
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java42
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java43
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json13
18 files changed, 230 insertions, 251 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index 7e5cf19b21..b6ab9d0ce6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
@@ -188,6 +188,15 @@ public class AAIUpdateTasks {
}
/**
+ * BPMN access method to update status of VfModule to Active in AAI
+ */
+ public void updateOrchestrationStatusActivateVfModule(BuildingBlockExecution execution) {
+ execution.setVariable("aaiActivateVfModuleRollback", false);
+ updateOrchestrationStatusForVfModule(execution, OrchestrationStatus.ACTIVE);
+ execution.setVariable("aaiActivateVfModuleRollback", true);
+ }
+
+ /**
* BPMN access method to update aaiDeactivateVfModuleRollback to true for deactivating the VfModule
*/
public void updateOrchestrationStatusDeactivateVfModule(BuildingBlockExecution execution) {
@@ -205,9 +214,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of L3Network to Assigned in AAI
- *
- * @param execution
- * @throws BBObjectNotFoundException
*/
public void updateOrchestrationStatusAssignedNetwork(BuildingBlockExecution execution) {
updateNetwork(execution, OrchestrationStatus.ASSIGNED);
@@ -215,9 +221,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of L3Network to Active in AAI
- *
- * @param execution
- * @throws BBObjectNotFoundException
*/
public void updateOrchestrationStatusActiveNetwork(BuildingBlockExecution execution) {
updateNetwork(execution, OrchestrationStatus.ACTIVE);
@@ -225,9 +228,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of L3Network to Created in AAI
- *
- * @param execution
- * @throws BBObjectNotFoundException
*/
public void updateOrchestrationStatusCreatedNetwork(BuildingBlockExecution execution) {
updateNetwork(execution, OrchestrationStatus.CREATED);
@@ -262,9 +262,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of L3Network Collection to Active in AAI
- *
- * @param execution
- * @throws BBObjectNotFoundException
*/
public void updateOrchestrationStatusActiveNetworkCollection(BuildingBlockExecution execution) {
execution.setVariable("aaiNetworkCollectionActivateRollback", false);
@@ -285,27 +282,7 @@ public class AAIUpdateTasks {
}
/**
- * BPMN access method to update status of VfModule to Active in AAI
- *
- * @param execution
- */
- public void updateOrchestrationStatusActivateVfModule(BuildingBlockExecution execution) {
- execution.setVariable("aaiActivateVfModuleRollback", false);
- try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE);
- execution.setVariable("aaiActivateVfModuleRollback", true);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActivateVfModule", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- /**
* BPMN access method to update HeatStackId of VfModule in AAI
- *
- * @param execution
*/
public void updateHeatStackIdVfModule(BuildingBlockExecution execution) {
try {
@@ -325,9 +302,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update L3Network after it was created in cloud
- *
- * @param execution
- * @throws Exception
*/
public void updateNetworkCreated(BuildingBlockExecution execution) throws Exception {
execution.setVariable("aaiNetworkActivateRollback", false);
@@ -369,9 +343,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update L3Network after it was updated in cloud
- *
- * @param execution
- * @throws Exception
*/
public void updateNetworkUpdated(BuildingBlockExecution execution) throws Exception {
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
@@ -399,8 +370,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update L3Network Object
- *
- * @param execution
*/
public void updateObjectNetwork(BuildingBlockExecution execution) {
try {
@@ -414,8 +383,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update ServiceInstance
- *
- * @param execution
*/
public void updateServiceInstance(BuildingBlockExecution execution) {
try {
@@ -430,8 +397,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update Vnf Object
- *
- * @param execution
*/
public void updateObjectVnf(BuildingBlockExecution execution) {
try {
@@ -445,8 +410,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of VfModuleRollback as true
- *
- * @param execution
*/
public void updateOrchestrationStatusDeleteVfModule(BuildingBlockExecution execution) {
execution.setVariable("aaiDeleteVfModuleRollback", false);
@@ -454,9 +417,6 @@ public class AAIUpdateTasks {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
vfModule.setHeatStackId("");
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
-
- VfModule copiedVfModule = vfModule.shallowCopyId();
- copiedVfModule.setHeatStackId("");
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED);
execution.setVariable("aaiDeleteVfModuleRollback", true);
} catch (Exception ex) {
@@ -467,8 +427,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update Model of VfModule
- *
- * @param execution
*/
public void updateModelVfModule(BuildingBlockExecution execution) {
try {
@@ -483,8 +441,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of FabricConfiguration to Assigned in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusAssignFabricConfiguration(BuildingBlockExecution execution) {
try {
@@ -499,8 +455,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of FabricConfiguration to Active in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) {
try {
@@ -515,8 +469,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of FabricConfiguration to deactive in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusDeactivateFabricConfiguration(BuildingBlockExecution execution) {
try {
@@ -532,8 +484,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update Ipv4OamAddress of Vnf
- *
- * @param execution
*/
public void updateIpv4OamAddressVnf(BuildingBlockExecution execution) {
try {
@@ -555,8 +505,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update ManagementV6Address of Vnf
- *
- * @param execution
*/
public void updateManagementV6AddressVnf(BuildingBlockExecution execution) {
try {
@@ -578,8 +526,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update ContrailServiceInstanceFqdn of VfModule
- *
- * @param execution
*/
public void updateContrailServiceInstanceFqdnVfModule(BuildingBlockExecution execution) {
try {
@@ -598,8 +544,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of Vnf to ConfigAssigned in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusConfigAssignedVnf(BuildingBlockExecution execution) {
try {
@@ -613,79 +557,16 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of Vnf to Configure in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusConfigDeployConfigureVnf(BuildingBlockExecution execution) {
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURE);
-
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigDeployConfigureVnf", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVnf(execution, OrchestrationStatus.CONFIGURE);
}
/**
* BPMN access method to update status of Vnf to configured in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusConfigDeployConfiguredVnf(BuildingBlockExecution execution) {
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURED);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigDeployConfiguredVnf", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- /**
- * BPMN access method to update status of VNF/VF-Module based on SO scope and action.
- *
- * @param execution - BuildingBlockExecution
- * @param scope - SO scope (vnf/vfModule)
- * @param action - action (configAssign/configDeploy/configUndeploy etc..)
- */
- public void updateOrchestrationStatusForCds(BuildingBlockExecution execution, String scope, String action) {
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- OrchestrationStatus status = getOrchestrationStatus(action);
- switch (scope) {
- case "vnf":
- aaiVnfResources.updateOrchestrationStatusVnf(vnf, status);
- break;
- case "vfModule":
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, status);
- break;
- default:
- throw new IllegalArgumentException(
- "Invalid scope to update orchestration status for CDS : " + action);
- }
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusForCds", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- private OrchestrationStatus getOrchestrationStatus(String action) {
- /**
- * At this state, OrcherstationStatus enum associated with configAssign and configDeploy. I am not sure which is
- * the correct approach. 1. Are we going to map each specific action to OrchestrationStauts ? 2. We will have
- * only one generic status for all actions ?
- */
-
- switch (action) {
- case "configAssign":
- return OrchestrationStatus.ASSIGNED;
- case "configDeploy":
- return OrchestrationStatus.CONFIGURED;
- default:
- throw new IllegalArgumentException("Invalid action to set Orchestration status: " + action);
- }
+ updateOrchestrationStatusForVnf(execution, OrchestrationStatus.CONFIGURED);
}
private void updateOrchestrationStatusForService(BuildingBlockExecution execution, OrchestrationStatus status) {
@@ -751,5 +632,4 @@ public class AAIUpdateTasks {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
-
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
index 8b78560521..97d78b5ee8 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
@@ -9,9 +9,9 @@
* 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.
@@ -91,7 +91,7 @@ public class VnfAdapterImpl {
public void postProcessVnfAdapter(BuildingBlockExecution execution) {
try {
- String vnfAdapterResponse = execution.getVariable("vnfAdapterRestV1Response");
+ String vnfAdapterResponse = execution.getVariable("WorkflowResponse");
if (!StringUtils.isEmpty(vnfAdapterResponse)) {
Object vnfRestResponse = unMarshal(vnfAdapterResponse);
if (vnfRestResponse instanceof CreateVfModuleResponse) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
index 9697246b03..9c55d0a922 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
@@ -1,7 +1,9 @@
package org.onap.so.bpmn.infrastructure.appc.tasks;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Optional;
import org.onap.aai.domain.yang.Vserver;
import org.onap.appc.client.lcm.model.Action;
@@ -29,6 +31,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class AppcOrchestratorPreProcessor {
@@ -84,8 +88,16 @@ public class AppcOrchestratorPreProcessor {
appcTaskRequest.setNewSoftwareVersion(newSoftwareVersion);
String operationsTimeout = JsonUtils.getJsonValue(payload, "operations_timeout");
appcTaskRequest.setOperationsTimeout(operationsTimeout);
- }
+ Map<String, String> configMap = new HashMap<>();
+ ObjectMapper objectMapper = new ObjectMapper();
+ String configParamsStr = JsonUtils.getJsonValue(payload, "configuration_parameters");
+ if (configParamsStr != null) {
+ configMap =
+ objectMapper.readValue(configParamsStr, new TypeReference<HashMap<String, String>>() {});
+ }
+ appcTaskRequest.setConfigParams(configMap);
+ }
ControllerSelectionReference controllerSelectionReference = catalogDbClient
.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, action.toString());
String controllerType = null;
@@ -229,8 +241,13 @@ public class AppcOrchestratorPreProcessor {
.isEmpty()) {
errorMessage = "APPC action Snapshot is missing vserverId parameter. ";
}
- break;
}
+ break;
+ case ConfigModify:
+ if (appcTaskRequest.getConfigParams().isEmpty() || appcTaskRequest.getConfigParams() == null) {
+ errorMessage = "APPC action ConfigModify is missing Configuration parameters. ";
+ }
+ break;
default:
break;
}
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
index 8499b6f7d1..ea3405d423 100644
--- 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
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix
- * Modifications Copyright (C) 2020 Huawei
+ * Modifications Copyright (C) 2020 Huawei Technologies Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +29,8 @@ 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.common.SoPropertyConstants;
import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.LcmControllerDE;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.PayloadGenerationException;
import org.onap.so.client.sdnc.common.SDNCConstants;
import org.onap.so.client.sdnc.lcm.*;
import org.onap.so.client.sdnc.lcm.beans.*;
@@ -59,26 +61,20 @@ public class SdncControllerDE extends LcmControllerDE {
logger.debug("Running activity for id: {}, name: {}", execution.getCurrentActivityId(),
execution.getCurrentActivityName());
- boolean result;
try {
LcmInput lcmInput = buildLcmInput(execution);
- if (lcmInput != null) {
- result = sendLcmRequest(execution, lcmInput);
- } else {
- logger.error("Build LCM Input error");
- result = false;
- }
- } catch (Exception e) {
- logger.error("Call SDNC LCM Client failure: ", e);
- result = false;
- }
+ sendLcmRequest(execution, lcmInput);
- if (result) {
execution.setVariable(SoPropertyConstants.CONTROLLER_STATUS, "Success");
- } else {
+ } catch (Exception e) {
execution.setVariable(SoPropertyConstants.CONTROLLER_STATUS, "Failure");
+
+ exceptionUtil.buildAndThrowWorkflowException(execution, SDNC_DELEGATE_EXECUTION_ERROR_CODE, e);
}
+ logger.debug("Finish activity for id: {}, name: {}", execution.getCurrentActivityId(),
+ execution.getCurrentActivityName());
+
return 0;
}
@@ -87,17 +83,24 @@ public class SdncControllerDE extends LcmControllerDE {
return SDNC_DELEGATE_EXECUTION_ERROR_CODE;
}
- private LcmOutput sendSyncRequest(String operation, LcmInput lcmInput) {
+ private LcmOutput sendSyncRequest(String operation, LcmInput lcmInput) throws BadResponseException {
SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder();
SDNCLcmRestClient sdncLcmRestClient;
try {
sdncLcmRestClient = sdncLcmClientBuilder.newSDNCLcmRestClient(operation);
} catch (SDNCLcmClientBuilderException e) {
logger.error("Create SDNCLcmRestClient error: ", e);
- return null;
+ throw new BadResponseException("Can not send request to SDNC.");
}
- return sdncLcmRestClient.sendRequest(lcmInput);
+ LcmOutput lcmOutput;
+ try {
+ lcmOutput = sdncLcmRestClient.sendRequest(lcmInput);
+ } catch (Exception e) {
+ logger.error("SDNCLcmRestClient sends request failure: ", e);
+ throw new BadResponseException("Send request to SDNC failure.");
+ }
+ return lcmOutput;
}
private LcmOutput selectLcmOutputFromDmaapResponses(List<LcmDmaapResponse> lcmDmaapResponses, LcmInput lcmInput) {
@@ -115,22 +118,22 @@ public class SdncControllerDE extends LcmControllerDE {
return null;
}
- private LcmOutput sendAsyncRequest(String operation, LcmInput lcmInput) {
+ private LcmOutput sendAsyncRequest(String operation, LcmInput lcmInput) throws BadResponseException {
SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder();
SDNCLcmDmaapClient sdncLcmDmaapClient;
try {
sdncLcmDmaapClient = sdncLcmClientBuilder.newSDNCLcmDmaapClient();
} catch (SDNCLcmClientBuilderException e) {
logger.error("Create SDNCLcmDmaapClient error: ", e);
- return null;
+ throw new BadResponseException("Can not send request to SDNC.");
}
LcmDmaapRequest lcmDmaapRequest = SDNCLcmMessageBuilder.buildLcmDmaapRequest(operation, lcmInput);
try {
sdncLcmDmaapClient.sendRequest(lcmDmaapRequest);
} catch (Exception e) {
- logger.error("SDNCLcmDmaapClient sends request error: ", e);
- return null;
+ logger.error("SDNCLcmDmaapClient sends request failure: ", e);
+ throw new BadResponseException("Send request to SDNC failure.");
}
long timeout = sdncLcmClientBuilder.getSDNCLcmProperties().getActionTimeout();
@@ -146,8 +149,9 @@ public class SdncControllerDE extends LcmControllerDE {
long stopTime = System.currentTimeMillis();
if ((stopTime - startTime) > timeout) {
- logger.error("Timeout for SDNC LCM action {}", lcmInput.getAction());
- return null;
+ String msg = "Timeout for SDNC LCM action " + lcmInput.getAction();
+ logger.error(msg);
+ throw new BadResponseException(msg);
}
}
}
@@ -158,7 +162,15 @@ public class SdncControllerDE extends LcmControllerDE {
return lcmAction.replaceAll(regex, replacement).toLowerCase();
}
- private LcmInput buildLcmInput(DelegateExecution execution) throws JsonProcessingException {
+ private String convertToSting(Object msgObject) throws PayloadGenerationException {
+ try {
+ return SDNCLcmPayloadBuilder.convertToSting(msgObject);
+ } catch (JsonProcessingException e) {
+ throw new PayloadGenerationException(e.getMessage());
+ }
+ }
+
+ private LcmInput buildLcmInput(DelegateExecution execution) throws PayloadGenerationException {
String requestId = String.valueOf(execution.getVariable(REQUEST_ID));
String requestAction = String.valueOf(execution.getVariable(SoPropertyConstants.SO_ACTION));
String pnfName = String.valueOf(execution.getVariable(PNF_CORRELATION_ID));
@@ -176,32 +188,33 @@ public class SdncControllerDE extends LcmControllerDE {
UpgradePreCheckPayload upgradePreCheckPayload;
upgradePreCheckPayload = SDNCLcmPayloadBuilder.buildUpgradePreCheckPayload(execution);
- lcmPayload = SDNCLcmPayloadBuilder.convertToSting(upgradePreCheckPayload);
+ lcmPayload = convertToSting(upgradePreCheckPayload);
break;
case SoPropertyConstants.ACTION_DOWNLOAD_N_E_SW:
lcmAction = SDNCLcmActionConstants.DOWNLOAD_N_E_SW;
DownloadNESwPayload downloadNESwPayload;
downloadNESwPayload = SDNCLcmPayloadBuilder.buildDownloadNESwPayload(execution);
- lcmPayload = SDNCLcmPayloadBuilder.convertToSting(downloadNESwPayload);
+ lcmPayload = convertToSting(downloadNESwPayload);
break;
case SoPropertyConstants.ACTION_ACTIVATE_N_E_SW:
lcmAction = SDNCLcmActionConstants.ACTIVATE_N_E_SW;
ActivateNESwPayload activateNESwPayload;
activateNESwPayload = SDNCLcmPayloadBuilder.buildActivateNESwPayload(execution);
- lcmPayload = SDNCLcmPayloadBuilder.convertToSting(activateNESwPayload);
+ lcmPayload = convertToSting(activateNESwPayload);
break;
case SoPropertyConstants.ACTION_POST_CHECK:
lcmAction = SDNCLcmActionConstants.UPGRADE_POST_CHECK;
UpgradePostCheckPayload upgradePostCheckPayload;
upgradePostCheckPayload = SDNCLcmPayloadBuilder.buildUpgradePostCheckPayload(execution);
- lcmPayload = SDNCLcmPayloadBuilder.convertToSting(upgradePostCheckPayload);
+ lcmPayload = convertToSting(upgradePostCheckPayload);
break;
default:
- logger.error("Unsupported SO Action: " + requestAction);
- return null;
+ String msg = "Unsupported SO Action: " + requestAction;
+ logger.error(msg);
+ throw new PayloadGenerationException(msg);
}
String subRequestId = UUID.randomUUID().toString();
@@ -209,32 +222,33 @@ public class SdncControllerDE extends LcmControllerDE {
SDNCLcmMessageBuilder.buildLcmInputForPnf(requestId, subRequestId, pnfName, lcmAction, lcmPayload);
ObjectMapper mapper = new ObjectMapper();
- String lcmInputMsg = mapper.writeValueAsString(lcmInput);
- logger.debug("SDNC input message for {}: {}", lcmAction, lcmInputMsg);
+ try {
+ String lcmInputMsg = mapper.writeValueAsString(lcmInput);
+ logger.debug("SDNC input message for {}: {}", lcmAction, lcmInputMsg);
+ } catch (JsonProcessingException e) {
+ throw new PayloadGenerationException(e.getMessage());
+ }
return lcmInput;
}
- private boolean parseLcmOutput(LcmOutput lcmOutput, String lcmAction) {
- if (lcmOutput == null) {
- logger.error("Call SDNC LCM API failure");
- return false;
- }
-
+ private void parseLcmOutput(LcmOutput lcmOutput, String lcmAction) throws BadResponseException {
LcmStatus lcmStatus = lcmOutput.getStatus();
+ int lcmStatusCode = lcmStatus.getCode();
String outputPayload = lcmOutput.getPayload();
- logger.debug("SDNC LCM output payload of action {}: {}", lcmAction, outputPayload);
- if (lcmStatus.getCode() == SDNCConstants.LCM_OUTPUT_SUCCESS_CODE) {
- logger.debug("Call SDNC LCM API for {} success, message: {}", lcmAction, lcmStatus.getMessage());
- return true;
+ if (lcmStatusCode == SDNCConstants.LCM_OUTPUT_SUCCESS_CODE) {
+ logger.debug("Call SDNC LCM API for {} success, code: {}, message: {}, payload: {}", lcmAction,
+ lcmStatusCode, lcmStatus.getMessage(), outputPayload);
} else {
- logger.error("Call SDNC LCM API for {} failure, message: {}", lcmAction, lcmStatus.getMessage());
- return false;
+ String msg = String.format("Call SDNC LCM API for %s failure, code: %d, message: %s, payload: %s",
+ lcmAction, lcmStatusCode, lcmStatus.getMessage(), outputPayload);
+ logger.error(msg);
+ throw new BadResponseException(msg);
}
}
- private boolean sendLcmRequest(DelegateExecution execution, LcmInput lcmInput) {
+ private void sendLcmRequest(DelegateExecution execution, LcmInput lcmInput) throws BadResponseException {
String actionMode = String.valueOf(execution.getVariable(SoPropertyConstants.SO_ACTION_MODE));
String lcmOperation = toLowerHyphen(lcmInput.getAction());
@@ -245,6 +259,6 @@ public class SdncControllerDE extends LcmControllerDE {
lcmOutput = sendSyncRequest(lcmOperation, lcmInput);
}
- return parseLcmOutput(lcmOutput, lcmInput.getAction());
+ parseLcmOutput(lcmOutput, lcmInput.getAction());
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
index d9f5e65ba3..cdba6e0e2f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
@@ -173,7 +173,7 @@ public class ManualHandlingTasks {
taskVariables.put(TASK_VARIABLE_DESCRIPTION, description);
TaskService taskService = execution.getProcessEngineServices().getTaskService();
- taskService.setVariables(taskId, taskVariables);
+ taskService.setVariablesLocal(taskId, taskVariables);
logger.debug("successfully created fallout task: " + taskId);
} catch (BpmnError e) {
logger.debug(BPMN_EXCEPTION + e.getMessage());
@@ -223,7 +223,7 @@ public class ManualHandlingTasks {
taskVariables.put(TASK_VARIABLE_VALID_RESPONSES, validResponses);
TaskService taskService = execution.getProcessEngineServices().getTaskService();
- taskService.setVariables(taskId, taskVariables);
+ taskService.setVariablesLocal(taskId, taskVariables);
logger.debug("successfully created pause task: " + taskId);
} catch (BpmnError e) {
logger.debug(BPMN_EXCEPTION + e.getMessage());
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index eead1761ea..e01149f981 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -83,7 +83,6 @@ import org.onap.so.serviceinstancebeans.Networks;
import org.onap.so.serviceinstancebeans.Pnfs;
import org.onap.so.serviceinstancebeans.RelatedInstance;
import org.onap.so.serviceinstancebeans.RequestDetails;
-import org.onap.so.serviceinstancebeans.RequestInfo;
import org.onap.so.serviceinstancebeans.Service;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.onap.so.serviceinstancebeans.VfModules;
@@ -169,18 +168,6 @@ public class WorkflowAction {
}
public void selectExecutionList(DelegateExecution execution) throws Exception {
- final String apiVersion = (String) execution.getVariable(BBConstants.G_APIVERSION);
- final String vnfType = (String) execution.getVariable(VNF_TYPE);
- String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
- final String createInstanceAction = "createInstance";
- final String serviceType =
- Optional.ofNullable((String) execution.getVariable(BBConstants.G_SERVICE_TYPE)).orElse("");
-
- List<OrchestrationFlow> orchFlows =
- (List<OrchestrationFlow>) execution.getVariable(BBConstants.G_ORCHESTRATION_FLOW);
- WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
- List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
- List<Resource> resourceList = new ArrayList<>();
execution.setVariable("sentSyncResponse", false);
execution.setVariable("homing", false);
execution.setVariable("calledHoming", false);
@@ -205,8 +192,9 @@ public class WorkflowAction {
WorkflowType resourceType = resource.getResourceType();
execution.setVariable("resourceName", resourceType.toString());
String resourceId = "";
- final String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
- if (resource.isGenerated() && requestAction.equalsIgnoreCase(createInstanceAction)
+ String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
+ WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
+ if (resource.isGenerated() && requestAction.equalsIgnoreCase("createInstance")
&& sIRequest.getRequestDetails().getRequestInfo().getInstanceName() != null) {
resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType,
sIRequest.getRequestDetails().getRequestInfo().getInstanceName(), sIRequest.getRequestDetails(),
@@ -214,6 +202,7 @@ public class WorkflowAction {
} else {
resourceId = resource.getResourceId();
}
+ String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
if ((serviceInstanceId == null || serviceInstanceId.isEmpty()) && resourceType == WorkflowType.SERVICE) {
serviceInstanceId = resourceId;
}
@@ -232,10 +221,16 @@ public class WorkflowAction {
"Could not resume request with request Id: " + requestId + ". No flowsToExecute was found");
}
} else {
+ String vnfType = (String) execution.getVariable(VNF_TYPE);
String cloudOwner = getCloudOwner(requestDetails.getCloudConfiguration());
+ List<OrchestrationFlow> orchFlows =
+ (List<OrchestrationFlow>) execution.getVariable(BBConstants.G_ORCHESTRATION_FLOW);
+ final String apiVersion = (String) execution.getVariable(BBConstants.G_APIVERSION);
+ final String serviceType =
+ Optional.ofNullable((String) execution.getVariable(BBConstants.G_SERVICE_TYPE)).orElse("");
if (aLaCarte) {
if (orchFlows == null || orchFlows.isEmpty()) {
- orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte,
+ orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, true,
cloudOwner, serviceType);
}
String key = "";
@@ -248,12 +243,12 @@ public class WorkflowAction {
}
}
boolean isConfiguration = isConfiguration(orchFlows);
- Resource resourceKey = new Resource(resourceType, key, aLaCarte);
+ Resource resourceKey = new Resource(resourceType, key, true);
if (isConfiguration && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks(
new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows)
.setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion)
- .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(aLaCarte)
+ .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(true)
.setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds)
.setRequestDetails(requestDetails).setExecution(execution));
@@ -269,19 +264,21 @@ public class WorkflowAction {
orchFlows = getVfModuleReplaceBuildingBlocks(
new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows)
.setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion)
- .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(aLaCarte)
+ .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(true)
.setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds)
.setRequestDetails(requestDetails).setExecution(execution));
}
for (OrchestrationFlow orchFlow : orchFlows) {
ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey,
- apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds,
+ apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds,
requestDetails, false, null, null, false);
flowsToExecute.add(ebb);
}
} else {
boolean foundRelated = false;
boolean containsService = false;
+ List<Resource> resourceList = new ArrayList<>();
+ List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
if (resourceType == WorkflowType.SERVICE && requestAction.equalsIgnoreCase(ASSIGNINSTANCE)) {
// SERVICE-MACRO-ASSIGN will always get user params with a
// service.
@@ -440,13 +437,6 @@ public class WorkflowAction {
return environment.getProperty(defaultCloudOwner);
}
- private boolean isSuppressRollback(RequestInfo requestInfo) {
- if (requestInfo != null) {
- return requestInfo.getSuppressRollback();
- }
- return false;
- }
-
protected <T> List<T> getRelatedResourcesInVfModule(String vnfId, String vfModuleId, Class<T> resultClass,
AAIObjectType type) {
List<T> vnfcs = new ArrayList<>();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
index 9de8e184f2..614401d32a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
@@ -22,18 +22,33 @@
package org.onap.so.client.aai.mapper;
-import org.modelmapper.ModelMapper;
-import org.modelmapper.PropertyMap;
-import org.onap.aai.domain.yang.RouteTargets;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.*;
-import org.springframework.stereotype.Component;
import java.util.List;
import org.modelmapper.Converter;
+import org.modelmapper.ModelMapper;
+import org.modelmapper.PropertyMap;
import org.modelmapper.spi.MappingContext;
+import org.onap.aai.domain.yang.RouteTargets;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget;
import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
+import org.springframework.stereotype.Component;
@Component
public class AAIObjectMapper {
@@ -46,6 +61,7 @@ public class AAIObjectMapper {
protected void configure() {
map().setServiceType(source.getModelInfoServiceInstance().getServiceType());
map().setServiceRole(source.getModelInfoServiceInstance().getServiceRole());
+ map().setServiceFunction(source.getModelInfoServiceInstance().getServiceFunction());
map().setModelInvariantId(source.getModelInfoServiceInstance().getModelInvariantUuid());
map().setModelVersionId(source.getModelInfoServiceInstance().getModelUuid());
map().setEnvironmentContext(source.getModelInfoServiceInstance().getEnvironmentContext());
@@ -178,6 +194,7 @@ public class AAIObjectMapper {
private Converter<List<Subnet>, org.onap.aai.domain.yang.Subnets> convertSubnets =
new Converter<List<Subnet>, org.onap.aai.domain.yang.Subnets>() {
+ @Override
public org.onap.aai.domain.yang.Subnets convert(
MappingContext<List<Subnet>, org.onap.aai.domain.yang.Subnets> context) {
return mapToAAISubNets(context.getSource());
@@ -186,6 +203,7 @@ public class AAIObjectMapper {
private Converter<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments> convertCtagAssignments =
new Converter<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments>() {
+ @Override
public org.onap.aai.domain.yang.CtagAssignments convert(
MappingContext<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments> context) {
return mapToAAICtagAssignmentList(context.getSource());
@@ -194,6 +212,7 @@ public class AAIObjectMapper {
private Converter<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments> convertSegmentationAssignments =
new Converter<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments>() {
+ @Override
public org.onap.aai.domain.yang.SegmentationAssignments convert(
MappingContext<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments> context) {
return mapToAAISegmentationAssignmentList(context.getSource());
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
index 97a9388f8d..16e8c2de7d 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -103,7 +103,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_CreateResponseTest() {
- execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE);
+ execution.setVariable("WorkflowResponse", VNF_ADAPTER_REST_CREATE_RESPONSE);
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId());
assertEquals(TEST_CONTRAIL_SERVICE_INSTANCE_FQDN, vfModule.getContrailServiceInstanceFqdn());
@@ -119,20 +119,20 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_CreateResponseTest_EmptyCreateVfModuleResponseTag() {
expectedException.expect(BpmnError.class);
- execution.setVariable("vnfAdapterRestV1Response", "<vfModuleStackId></vfModuleStackId>");
+ execution.setVariable("WorkflowResponse", "<vfModuleStackId></vfModuleStackId>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
}
@Test
public void postProcessVnfAdapter_CreateResponseTest_EmptyVfModuleStackIdTag() {
- execution.setVariable("vnfAdapterRestV1Response", "<createVfModuleResponse></createVfModuleResponse>");
+ execution.setVariable("WorkflowResponse", "<createVfModuleResponse></createVfModuleResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
}
@Test
public void postProcessVnfAdapter_CreateResponseTest_EmptyHeatStackId() {
- execution.setVariable("vnfAdapterRestV1Response",
+ execution.setVariable("WorkflowResponse",
"<createVfModuleResponse><vfModuleStackId></vfModuleStackId></createVfModuleResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
@@ -140,7 +140,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_CreateResponseTest_EmptyVfModuleOutputs() {
- execution.setVariable("vnfAdapterRestV1Response",
+ execution.setVariable("WorkflowResponse",
"<createVfModuleResponse><vfModuleOutputs></vfModuleOutputs></createVfModuleResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
@@ -156,7 +156,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest() {
vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_DELETE_RESPONSE);
+ execution.setVariable("WorkflowResponse", VNF_ADAPTER_REST_DELETE_RESPONSE);
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
assertEquals(vfModule.getContrailServiceInstanceFqdn(), "");
@@ -170,7 +170,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleOutputs() {
- execution.setVariable("vnfAdapterRestV1Response",
+ execution.setVariable("WorkflowResponse",
"<createVfModuleResponse><vfModuleOutputs></vfModuleOutputs></createVfModuleResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
@@ -183,14 +183,14 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_ResponseNullTest() {
- execution.setVariable("vnfAdapterRestV1Response", null);
+ execution.setVariable("WorkflowResponse", null);
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
}
@Test
public void postProcessVnfAdapter_ResponseEmptyTest() {
- execution.setVariable("vnfAdapterRestV1Response", "");
+ execution.setVariable("WorkflowResponse", "");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
}
@@ -198,7 +198,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest_VfModuleDeletedFalse() {
vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response",
+ execution.setVariable("WorkflowResponse",
"<deleteVfModuleResponse><vfModuleDeleted>false</vfModuleDeleted></deleteVfModuleResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId());
@@ -207,14 +207,14 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest_EmptyDeleteVfModuleResponseTag() {
expectedException.expect(BpmnError.class);
- execution.setVariable("vnfAdapterRestV1Response", "<vfModuleDeleted></vfModuleDeleted>");
+ execution.setVariable("WorkflowResponse", "<vfModuleDeleted></vfModuleDeleted>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
}
@Test
public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleDeletedTag() {
vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response", "<deleteVfModuleResponse></deleteVfModuleResponse>");
+ execution.setVariable("WorkflowResponse", "<deleteVfModuleResponse></deleteVfModuleResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId());
}
@@ -230,7 +230,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_CreateVolumeResponseTest() {
- execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_VOLUME_CREATE_RESPONSE);
+ execution.setVariable("WorkflowResponse", VNF_ADAPTER_VOLUME_CREATE_RESPONSE);
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId());
}
@@ -238,7 +238,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_CreateVolumeEmptyResponseTest() {
expectedException.expect(BpmnError.class);
- execution.setVariable("vnfAdapterRestV1Response", "<createVolumeGroupResponse></createVolumeGroupResponse>");
+ execution.setVariable("WorkflowResponse", "<createVolumeGroupResponse></createVolumeGroupResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(volumeGroup.getHeatStackId());
}
@@ -246,7 +246,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest_DeleteVolumeGroup() {
volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_VOLUME_DELETE_RESPONSE);
+ execution.setVariable("WorkflowResponse", VNF_ADAPTER_VOLUME_DELETE_RESPONSE);
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(volumeGroup.getHeatStackId());
}
@@ -255,7 +255,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest_VolumeGroupDeletedFalse() {
volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response",
+ execution.setVariable("WorkflowResponse",
"<deleteVolumeGroupResponse><volumeGroupDeleted>false</volumeGroupDeleted></deleteVolumeGroupResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId());
@@ -264,14 +264,14 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest_EmptyDeleteVolumeGroupResponseTag() {
expectedException.expect(BpmnError.class);
- execution.setVariable("vnfAdapterRestV1Response", "<volumeGroupDeleted></volumeGroupDeleted>");
+ execution.setVariable("WorkflowResponse", "<volumeGroupDeleted></volumeGroupDeleted>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
}
@Test
public void postProcessVnfAdapter_DeleteResponseTest_EmptyVolumeGroupDeletedTag() {
volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response", "<deleteVolumeGroupResponse></deleteVolumeGroupResponse>");
+ execution.setVariable("WorkflowResponse", "<deleteVolumeGroupResponse></deleteVolumeGroupResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId());
}
@@ -281,7 +281,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),
ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID));
- execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE);
+ execution.setVariable("WorkflowResponse", VNF_ADAPTER_REST_CREATE_RESPONSE);
expectedException.expect(BpmnError.class);
vnfAdapterImpl.postProcessVnfAdapter(execution);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
index c78b652bd0..ea1f7b47ad 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
@@ -45,6 +45,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.policy.JettisonStyleMapperProvider;
@@ -163,4 +164,46 @@ public class AppcOrchestratorPreProcessorTest extends BaseTaskTest {
genericVnf.setIpv4OamAddress("127.0.0.1");
return genericVnf;
}
+
+ @Test
+ public void buildAppcTaskRequestConfigModifyTest() throws Exception {
+ final String expectedRequestJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "appcTaskRequestConfigModify.json")));
+ ApplicationControllerTaskRequest expectedTaskRequest =
+ mapper.readValue(expectedRequestJson, ApplicationControllerTaskRequest.class);
+ execution.getLookupMap().put(ResourceKey.GENERIC_VNF_ID, "-TEST");
+ fillRequiredAppcExecutionFieldsConfigModify();
+ GenericVnf genericVnf = getTestGenericVnf();
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ mockReferenceResponseForConfigModify();
+ execution.getLookupMap().put(ResourceKey.VF_MODULE_ID, "VF-MODULE-ID-TEST");
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("VF-MODULE-ID");
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ appcOrchestratorPreProcessor.buildAppcTaskRequest(execution, "ConfigModify");
+ ApplicationControllerTaskRequest actualTaskRequest = execution.getVariable("appcOrchestratorRequest");
+ assertThat(actualTaskRequest, sameBeanAs(expectedTaskRequest));
+ }
+
+ private void fillRequiredAppcExecutionFieldsConfigModify() {
+ RequestContext context = new RequestContext();
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setPayload(
+ "{\"request_parameters\":{\"host_ip_address\":\"10.10.10.10\"},\"configuration_parameters\":{\"name1\":\"value1\",\"name2\":\"value2\"}}");
+ context.setRequestParameters(requestParameters);
+ context.setMsoRequestId("TEST-MSO-ID");
+ execution.setVariable("aicIdentity", "AIC-TEST");
+ execution.setVariable("vmIdList", "VM-ID-LIST-TEST");
+ execution.setVariable("vserverIdList", "VSERVER-ID-LIST");
+ execution.setVariable("identityUrl", "IDENTITY-URL-TEST");
+ execution.getGeneralBuildingBlock().setRequestContext(context);
+ }
+
+ private void mockReferenceResponseForConfigModify() {
+ ControllerSelectionReference reference = new ControllerSelectionReference();
+ reference.setControllerName("APPC");
+ when(catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(eq("TEST-VNF-TYPE"),
+ eq(Action.ConfigModify.toString()))).thenReturn(reference);
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
index b6dcd96534..e3bbd11cc4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
@@ -100,7 +100,7 @@ public class ManualHandlingTasksTest extends BaseTaskTest {
when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices);
when(processEngineServices.getTaskService()).thenReturn(taskService);
manualHandlingTasks.setFalloutTaskVariables(task);
- verify(taskService, times(1)).setVariables(any(String.class), any(Map.class));
+ verify(taskService, times(1)).setVariablesLocal(any(String.class), any(Map.class));
}
@Test
@@ -110,7 +110,7 @@ public class ManualHandlingTasksTest extends BaseTaskTest {
when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices);
when(processEngineServices.getTaskService()).thenReturn(taskService);
manualHandlingTasks.setPauseTaskVariables(task);
- verify(taskService, times(1)).setVariables(any(String.class), any(Map.class));
+ verify(taskService, times(1)).setVariablesLocal(any(String.class), any(Map.class));
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
index dc64e4ee48..1e58a83f0a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
@@ -138,6 +138,7 @@ public class AAIObjectMapperTest {
ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
modelInfoServiceInstance.setServiceType("SITYPE");
modelInfoServiceInstance.setServiceRole("SIROLE");
+ modelInfoServiceInstance.setServiceFunction("SIFUNCTION");
modelInfoServiceInstance.setModelInvariantUuid("MIUUID");
modelInfoServiceInstance.setModelUuid("MUUID");
modelInfoServiceInstance.setEnvironmentContext("EC");
@@ -163,6 +164,8 @@ public class AAIObjectMapperTest {
serviceInstance.getModelInfoServiceInstance().getEnvironmentContext());
assertEquals(AAIServiceInstance.getWorkloadContext(),
serviceInstance.getModelInfoServiceInstance().getWorkloadContext());
+ assertEquals(AAIServiceInstance.getServiceFunction(),
+ serviceInstance.getModelInfoServiceInstance().getServiceFunction());
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
index 109dc55294..ccd4376a10 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java
index a482da5158..9dfc245f68 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json
index 19d42dddb9..4c97dbc53c 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json
@@ -19,7 +19,7 @@
"allocationPools": [{
"start": "107.244.64.2",
"end": "107.244.64.16"
- }]
+ }]
}
],
"providerVlanNetwork": {
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json
index b57c8341f1..3ba5627b38 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json
@@ -14,13 +14,13 @@
"backout": false,
"failIfExists": false,
"enableBridge": true,
- "msoRequest":
+ "msoRequest":
{
"requestId": "requestId",
"serviceInstanceId": "serviceInstanceId"
},
- "vfModuleParams":
+ "vfModuleParams":
{
"vnf_id": "vnfId",
"vnf_name": "vnfName",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json
index da826b8a89..3fbf026176 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json
@@ -12,13 +12,13 @@
"backout": false,
"failIfExists": false,
"enableBridge": true,
- "msoRequest":
+ "msoRequest":
{
"requestId": "requestId",
"serviceInstanceId": "serviceInstanceId"
},
- "vfModuleParams":
+ "vfModuleParams":
{
"environment_context": "environmentContext",
"key1": "value1",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json
index 54f6e403ed..9f554490bd 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json
@@ -14,13 +14,13 @@
"backout": false,
"failIfExists": false,
"enableBridge": true,
- "msoRequest":
+ "msoRequest":
{
"requestId": "requestId",
"serviceInstanceId": "serviceInstanceId"
},
- "vfModuleParams":
+ "vfModuleParams":
{
"vnf_id": "vnfId",
"vnf_name": "vnfName",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json
new file mode 100644
index 0000000000..040c680d1c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json
@@ -0,0 +1,13 @@
+{
+ "ApplicationControllerTaskRequest": {
+ "controllerType": "APPC",
+ "action": "ConfigModify",
+ "identityUrl": "IDENTITY-URL-TEST",
+ "applicationControllerVnf": {
+ "vnfId": "TEST-VNF-ID",
+ "vnfName": "TEST-VNF-NAME",
+ "vnfHostIpAddress": "127.0.0.1"
+ },
+ "configParams": {"name1":"value1", "name2":"value2"}
+}
+}