aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/main
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-09-21 15:24:50 +0000
committerGerrit Code Review <gerrit@onap.org>2018-09-21 15:24:50 +0000
commit47b07012807ef3b3c6d39f8bb2afbe21e51dfffd (patch)
tree83f86b157f0811bb497550ae670dbf1a8791adbc /bpmn/so-bpmn-tasks/src/main
parentbe96dc7c39eed6142430d8c0486b1140a5c3a921 (diff)
parenta9696cdf3dd5da824eb23456b39e2897a15f03a8 (diff)
Merge "various bugfixes for casablanca"
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java22
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java49
3 files changed, 43 insertions, 40 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
index 39f4c7822a..5f263e8b4b 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.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.
@@ -73,7 +73,7 @@ public class SDNCAssignTasks {
public void assignVnf(BuildingBlockExecution execution) {
try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ GeneralBuildingBlock gBBInput = execution.getVariable("generalBuildingBlock");
RequestContext requestContext = gBBInput.getRequestContext();
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
@@ -85,7 +85,7 @@ public class SDNCAssignTasks {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
-
+
public void assignVfModule(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -101,14 +101,14 @@ public class SDNCAssignTasks {
}
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
-
- String response = sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext);
+
+ String response = sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext);
execution.setVariable("SDNCAssignResponse_"+ vfModule.getVfModuleId(), response);
- } catch (Exception ex) {
+ } catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
-
+
/**
* BPMN access method to perform Assign action on SDNC for L3Network
* @param execution
@@ -117,14 +117,14 @@ public class SDNCAssignTasks {
public void assignNetwork(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
-
+
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
-
+
Customer customer = gBBInput.getCustomer();
RequestContext requestContext = gBBInput.getRequestContext();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
-
+
sdncNetworkResources.assignNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index 9e4b01eea5..d3f817c2a5 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -221,7 +221,7 @@ public class WorkflowActionBBTasks {
}
public void checkRetryStatus(DelegateExecution execution) {
- if (execution.getVariable("handlingCode") == "Retry") {
+ if (execution.getVariable("handlingCode").equals("Retry")) {
int currSequence = (int) execution.getVariable("gCurrentSequence");
currSequence--;
execution.setVariable("gCurrentSequence", currSequence);
@@ -239,8 +239,9 @@ public class WorkflowActionBBTasks {
List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution
.getVariable("flowsToExecute");
List<ExecuteBuildingBlock> rollbackFlows = new ArrayList();
- int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE) - 1;
- for (int i = flowsToExecute.size() - 1; i >= 0; i--) {
+ int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE) + 1;
+ int listSize = flowsToExecute.size();
+ for (int i = listSize - 1; i >= 0; i--) {
if (i >= currentSequence) {
flowsToExecute.remove(i);
} else {
@@ -248,11 +249,13 @@ public class WorkflowActionBBTasks {
BuildingBlock bb = flowsToExecute.get(i).getBuildingBlock();
String flowName = flowsToExecute.get(i).getBuildingBlock().getBpmnFlowName();
if (flowName.contains("Assign")) {
- flowName = "Unassign" + flowName.substring(7, flowName.length());
+ flowName = "Unassign" + flowName.substring(6, flowName.length());
} else if (flowName.contains("Create")) {
flowName = "Delete" + flowName.substring(6, flowName.length());
} else if (flowName.contains("Activate")) {
flowName = "Deactivate" + flowName.substring(8, flowName.length());
+ }else{
+ continue;
}
flowsToExecute.get(i).getBuildingBlock().setBpmnFlowName(flowName);
rollbackFlows.add(flowsToExecute.get(i));
@@ -262,7 +265,6 @@ public class WorkflowActionBBTasks {
execution.setVariable("isRollbackNeeded", false);
else
execution.setVariable("isRollbackNeeded", true);
-
execution.setVariable("flowsToExecute", rollbackFlows);
execution.setVariable("handlingCode", "PreformingRollback");
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
index aefb84c606..ee1d432b6f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
@@ -26,21 +26,14 @@ import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpStatus;
-import org.json.JSONObject;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
-import org.onap.so.logging.jaxrs.filter.SpringClientFilter;
-import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.http.client.BufferingClientHttpRequestFactory;
-import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
-import org.springframework.web.client.RestTemplate;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -99,24 +92,32 @@ public class SdnCommonTasks {
* @return
* @throws BadResponseException
*/
- public String validateSDNResponse(LinkedHashMap<?, ?> output) throws BadResponseException {
- if (CollectionUtils.isEmpty(output)) {
- msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, NO_RESPONSE_FROM_SDNC, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NO_RESPONSE_FROM_SDNC);
- throw new BadResponseException(NO_RESPONSE_FROM_SDNC);
+ public String validateSDNResponse(LinkedHashMap<?, ?> output) throws BadResponseException {
+ if (CollectionUtils.isEmpty(output)) {
+ msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, NO_RESPONSE_FROM_SDNC, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NO_RESPONSE_FROM_SDNC);
+ throw new BadResponseException(NO_RESPONSE_FROM_SDNC);
+ }
+ LinkedHashMap<?, ?> embeddedResponse =(LinkedHashMap<?, ?>) output.get("output");
+ String responseCode = "";
+ String responseMessage = "";
+ if (embeddedResponse != null) {
+ responseCode = (String) embeddedResponse.get(RESPONSE_CODE);
+ responseMessage = (String) embeddedResponse.get(RESPONSE_MESSAGE);
}
- String responseCode = (String) output.get(RESPONSE_CODE);
- String responseMessage = (String) output.get(RESPONSE_MESSAGE);
- msoLogger.info("ResponseCode: " + responseCode + " ResponseMessage: " + responseMessage);
- int code = StringUtils.isNotEmpty(responseCode) ? Integer.parseInt(responseCode) : 0;
- if (isHttpCodeSuccess(code)) {
- msoLogger.info("Successful Response from SDNC");
- return responseMessage;
- } else {
- String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage);
- msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError, errorMessage);
- throw new BadResponseException(errorMessage);
- }
- }
+
+ msoLogger.info("ResponseCode: " + responseCode + " ResponseMessage: " + responseMessage);
+ int code = StringUtils.isNotEmpty(responseCode) ? Integer.parseInt(responseCode) : 0;
+ if (isHttpCodeSuccess(code)) {
+ msoLogger.info("Successful Response from SDNC");
+ return responseMessage;
+ } else {
+ String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage);
+ msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, errorMessage, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.DataError, errorMessage);
+ throw new BadResponseException(errorMessage);
+ }
+ }
/***
*