diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-09-19 09:56:15 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-09-20 16:01:40 -0400 |
commit | a9696cdf3dd5da824eb23456b39e2897a15f03a8 (patch) | |
tree | 88b631cb9fad84b4be4c53e5236c40f7fa589531 /bpmn/so-bpmn-tasks/src/main/java/org/onap | |
parent | 7728df703f403ffc09e79b1bb85df412aa3cbd0d (diff) |
various bugfixes for casablanca
fixed unit tests after addition of A&AI edge label
added option for edgelabel between vnf inst group
added belongs to in connecting a vnf to instance group
- Adding test for
getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAn
dWorkStep method in the catalogdb client
correct default RainyDay table search input
updated custom resolver to include float and added comment to explain
timestamp configuration
added a custom resolver and updated snake yaml version
Replacing bowman client with restTemplate.exchange | Add Accept and
Content-Type to headers
Removing the unused imports as well
Implementing some review comments for hte tests being ignored
Replacing bowman client with restTemplate.exchange |Fixing Junits
Replacing bowman client with restTemplate.exchange | Making Data
inserts to go specifically in requestDB
Replacing bowman client with restTemplate.exchange | Adding Junits
Replacing bowman client with restTemplate.exchange | Adding Junits
Replacing bowman client with restTemplate.exchange | Adding Junits
Replacing bowman client with restTemplate.exchange
- Updated tosca parser version to 1.4.3 and upgraded vnfc test case
with new csar to pass with latest parser code.
added test case for when workflow has not called all flows
fixed issue with rollback and retry in workflowaction
Reverted homing changes and changes assign vnf to use the homing
produced GeneralBuildingBlock.
fixed unit test to build the correct format hashmap
reverted extraction back to LinkedHashMap
marshal sdnc output to an object
removed unused variables and imports
extract response code/message from embedded map
add junits to parse SDNC assign response
removed missed org.openecomp.mso imports from bpmn
Change-Id: Ib2b6591a744ecb5b08c522494cdf1ad7dae18a08
Issue-ID: SO-1069
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java/org/onap')
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); + } + } /*** * |