From 63bee11f255fcd2cc39a3d87c208aa6e517a8f85 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Sun, 20 Jan 2019 16:10:18 -0500 Subject: Bug fixes from AT&T January 20th sorted vfmodules by base last for negative action reqs store Response in execution as String on network delete added functionality to skip rollback based on flag # Conflicts: # bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflo w/tasks/WorkflowAction.java require XML in the header for delete network request Update APP-C LCM Client library version to 1.7.0. replaced wiremock style test with mockito test Handle AAIClient Exps in CreateCustomerV1 getServiceInstance() changed default status code to be configurable Replace vnfType by nfRole in the healthcheck request to SDNO. updated error messages in sdnc handler and flow status updated flow status message on completion of flow Send GenericVnf object for AAI VNF update for vnf-api updates Add a JUnit test file for SDNOValidatorImpl.java Set nodeType on the inner SDNO request as per update from SDNO. updated rollbackToAssigned logic to remove unassign flows updated sdnc handler error message for client error added exception handling for httpclienterror in sdnc out map workflow exception so error is reported throws sdnc error message on bad response from sdnc add catalog entries for TRANSPORT service delete flows change script number that was duplicate add find method to NorthBoundRequestRepository include serviceType in hash code use asterisk for all non-TRANSPORT flow db entries alacart true, rm not needed transport srvc model steps correct insert query syntax for orchestration_flow support serviceType (TRANSPORT) process flow fix SDNCAdapterException causing no callback to bpmn use JsonAlias for alternate case when deserializing GRM client will accept both "serviceEndPointList" and "ServiceEndPointList" root node in the JSON response. AAIRestClient now uses getSystemName in headers finishtime should not be returned in requeststatus Change-Id: I81a185252b057020f7f36f125c85c3357756da88 Issue-ID: SO-1403 Signed-off-by: Benjamin, Max (mb388a) --- .../scripts/AbstractServiceTaskProcessor.groovy | 8 ++--- .../bpmn/common/scripts/UpdateAAIGenericVnf.groovy | 34 ++++++++++------------ .../tasks/ExecuteBuildingBlockRainyDay.java | 4 ++- .../tasks/ExecuteBuildlingBlockRainyDayTest.java | 2 +- .../src/test/resources/application-test.yaml | 1 + 5 files changed, 25 insertions(+), 24 deletions(-) (limited to 'bpmn/MSOCommonBPMN/src') diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy index 9e71313e09..57af763ed5 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy @@ -20,8 +20,6 @@ package org.onap.so.bpmn.common.scripts; -import groovy.json.JsonSlurper - import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.camunda.bpm.engine.variable.VariableMap @@ -30,11 +28,13 @@ import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats import org.camunda.bpm.engine.variable.impl.value.ObjectValueImpl import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder -import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException import org.onap.so.client.aai.AAIResourcesClient import org.springframework.web.util.UriUtils +import groovy.json.JsonSlurper + public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcessor { public MsoUtils utils = new MsoUtils() @@ -767,4 +767,4 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess public AAIResourcesClient getAAIClient(){ return new AAIResourcesClient(); } -} \ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy index 9fd16340b6..f96e3bea0e 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy @@ -174,7 +174,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { String newPersonaModelId = execution.getVariable('UAAIGenVnf_personaModelId') String newPersonaModelVersion = execution.getVariable('UAAIGenVnf_personaModelVersion') - String personaModelVersionEntry = "" + String personaModelVersionEntry = null if (newPersonaModelId != null || newPersonaModelVersion != null) { if (newPersonaModelId != genericVnf.getModelInvariantId()) { def msg = 'Can\'t update Generic VNF ' + vnfId + ' since there is \'persona-model-id\' mismatch between the current and new values' @@ -188,7 +188,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { // Handle ipv4-oam-address String ipv4OamAddress = execution.getVariable('UAAIGenVnf_ipv4OamAddress') - String ipv4OamAddressEntry = "" + String ipv4OamAddressEntry = null if (ipv4OamAddress != null) { // Construct payload ipv4OamAddressEntry = updateGenericVnfNode(origRequest, 'ipv4-oam-address') @@ -196,7 +196,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { // Handle management-v6-address String managementV6Address = execution.getVariable('UAAIGenVnf_managementV6Address') - String managementV6AddressEntry = "" + String managementV6AddressEntry = null if (managementV6Address != null) { // Construct payload managementV6AddressEntry = updateGenericVnfNode(origRequest, 'management-v6-address') @@ -204,21 +204,19 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { // Handle orchestration-status String orchestrationStatus = execution.getVariable('UAAIGenVnf_orchestrationStatus') - String orchestrationStatusEntry = "" + String orchestrationStatusEntry = null if (orchestrationStatus != null) { // Construct payload orchestrationStatusEntry = updateGenericVnfNode(origRequest, 'orchestration-status') } - - String payload = """ - { ${personaModelVersionEntry} - ${ipv4OamAddressEntry} - ${managementV6AddressEntry} - ${orchestrationStatusEntry} - "vnf-id": "${vnfId}" - } - """ - + + org.onap.aai.domain.yang.GenericVnf payload = new org.onap.aai.domain.yang.GenericVnf(); + payload.setVnfId(vnfId) + payload.setPersonaModelVersion(personaModelVersionEntry) + payload.setIpv4OamAddress(ipv4OamAddressEntry) + payload.setManagementV6Address(managementV6AddressEntry) + payload.setOrchestrationStatus(orchestrationStatusEntry) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) try { @@ -246,16 +244,16 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { public String updateGenericVnfNode(String origRequest, String elementName) { if (!utils.nodeExists(origRequest, elementName)) { - return "" + return null } def elementValue = utils.getNodeText(origRequest, elementName) if (elementValue == 'DELETE') { - // Set the element being deleted to null - return """"${elementName}": null,""" + // Set the element being deleted to empty string + return "" } else { - return """"${elementName}": "${elementValue}",""" + return elementValue } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java index 6c2df13c61..d2e0b07dd1 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java @@ -53,6 +53,7 @@ public class ExecuteBuildingBlockRainyDay { @Autowired private Environment environment; protected String retryDurationPath = "mso.rainyDay.retryDurationMultiplier"; + protected String defaultCode = "mso.rainyDay.defaultCode"; public void setRetryTimer(DelegateExecution execution) { try { @@ -149,7 +150,8 @@ public class ExecuteBuildingBlockRainyDay { execution.setVariable(HANDLING_CODE, handlingCode); } catch (Exception e) { msoLogger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = Abort"); - execution.setVariable(HANDLING_CODE, "Abort"); + String code = this.environment.getProperty(defaultCode); + execution.setVariable(HANDLING_CODE, code); } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java index 9af9b2f2c9..cb5683dcc8 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java @@ -21,7 +21,7 @@ package org.onap.so.bpmn.servicedecomposition.tasks; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; diff --git a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml index 1651f4f1fc..18f94f3b88 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml +++ b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml @@ -110,6 +110,7 @@ mso: rollback: 'true' rainyDay: retryDurationMultiplier: '2' + defaultCode: Abort site-name: localDevEnv workflow: default: -- cgit 1.2.3-korg