diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN')
12 files changed, 66 insertions, 23 deletions
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..00bd8e9ef8 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 @@ -694,6 +694,32 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess } /** + * Constructs a workflow message callback URL for the specified message type and correlator. + * This type of callback URL is used when a workflow wants an MSO adapter (like the SDNC + * adapter) to call it back. In other words, this is for callbacks internal to the MSO + * complex. Use <code>createWorkflowMessageAdapterCallbackURL</code> if the callback + * will come from outside the MSO complex. + * @param endpoint endpoint address to contruct URL from + * @param messageType the message type (e.g. SDNCAResponse or VNFAResponse) + * @param correlator the correlator value (e.g. a request ID) + */ + public String createCallbackURL(String endpoint, String messageType, String correlator) { + if (endpoint == null || endpoint.isEmpty()) { + ExceptionUtil exceptionUtil = new ExceptionUtil() + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, + 'mso:workflow:message:endpoint was not passed in') + } + + while (endpoint.endsWith('/')) { + endpoint = endpoint.substring(0, endpoint.length()-1) + } + + return endpoint + + '/' + UriUtils.encodePathSegment(messageType, 'UTF-8') + + '/' + UriUtils.encodePathSegment(correlator, 'UTF-8') + } + + /** * * Constructs a workflow message callback URL for the specified message type and correlator. * This type of callback URL is used when a workflow wants a system outside the MSO complex diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy index ff5dabf99a..c19851d223 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy @@ -206,6 +206,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { idXml = "" } idXml = utils.removeXmlPreamble(idXml) + idXml = utils.removeXmlNamespaces(idXml) msoLogger.debug("Incoming Instance Id Xml: " + idXml) String payload = """ diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy index 7028f6eeed..aa0d8ace6a 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy @@ -152,9 +152,7 @@ class OofHoming extends AbstractServiceTaskProcessor { execution.setVariable("oofRequest", oofRequest) utils.log("DEBUG", "OOF Request is: " + oofRequest, isDebugEnabled) - String endpoint = UrnPropertiesReader.getVariable("mso.oof.service.agnostic.endpoint", execution) - String host = UrnPropertiesReader.getVariable("mso.oof.service.agnostic.host", execution) - String url = host + endpoint + String url = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) utils.log("DEBUG", "Posting to OOF Url: " + url, isDebugEnabled) logDebug("URL to be used is: " + url, isDebugEnabled) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy index d95795906f..b1da7cf49b 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -87,7 +87,9 @@ class OofUtils { ArrayList requiredCandidates = null) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("DEBUG", "Started Building OOF Request", isDebugEnabled) - def callbackUrl = utils.createWorkflowMessageAdapterCallbackURL(execution, "oofResponse", requestId) + String callbackEndpoint = UrnPropertiesReader.getVariable("mso.oof.callbackEndpoint", execution) + utils.log("DEBUG", "mso.oof.callbackEndpoint is: " + callbackEndpoint, isDebugEnabled) + def callbackUrl = utils.createWorkflowMessageAdapterCallbackURL(callbackEndpoint, "oofResponse", requestId) def transactionId = requestId //ServiceInstance Info ServiceInstance serviceInstance = decomposition.getServiceInstance() diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy index e182ae3300..1a55bf2a0e 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy @@ -20,6 +20,7 @@ package org.onap.so.bpmn.common.scripts +import javax.ws.rs.NotFoundException import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.camunda.bpm.model.dmn.instance.OrganizationUnit @@ -124,10 +125,11 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { try { AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) AAIResourcesClient resourceClient = new AAIResourcesClient() - AAIResultWrapper wrapper = resourceClient.get(uri.depth(Depth.ONE)) + AAIResultWrapper wrapper = resourceClient.get(uri.depth(Depth.ONE), NotFoundException.class) GenericVnf responseData = wrapper.asBean(GenericVnf.class).get() execution.setVariable('PUAAIVfMod_getVnfResponse', responseData) + execution.setVariable('PUAAIVfMod_getVnfResponseCode', 200) } catch (Exception ex) { msoLogger.error(ex); @@ -176,8 +178,8 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { execution.setVariable('PUAAIVfMod_vfModuleValidationError', msg) execution.setVariable('PUAAIVfMod_vfModuleOK', false) } else { - AAIResultWrapper wrapper = resourceClient.get(uri) - org.onap.aai.domain.yang.VfModule vfModule = wrapper.asBean(org.onap.aai.domain.yang.VfModule.class) + AAIResultWrapper wrapper = resourceClient.get(uri, NotFoundException.class) + org.onap.aai.domain.yang.VfModule vfModule = wrapper.asBean(org.onap.aai.domain.yang.VfModule.class).get() def orchestrationStatus = execution.getVariable('PUAAIVfMod_orchestrationStatus') if (vfModule.isBaseVfModule && genericVnf.getVfModules().getVfModule().size() > 1 && vfModule.getOrchestrationStatus().equals('pending-delete')) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java index 47e36424dd..45bc27d840 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java @@ -85,9 +85,9 @@ public class PayloadClient { public static Optional<String> healthCheckFormat(String vnfName, String vnfHostIpAddress) throws JsonProcessingException{ HealthCheckAction payloadResult = new HealthCheckAction(); RequestParametersHealthCheck requestParams = new RequestParametersHealthCheck(); - requestParams.setVnfHostIpAddress(vnfHostIpAddress); + requestParams.setHostIpAddress(vnfHostIpAddress); payloadResult.setRequestParameters(requestParams); - return Optional.of((mapper.writeValueAsString(payloadResult)).replaceAll("\"", "\\\\\"")); + return Optional.of((mapper.writeValueAsString(payloadResult))); } public static Optional<String> snapshotFormat(String vmId, String identityUrl)throws JsonProcessingException{ diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java index 053ac5e741..60030ee3dd 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java @@ -32,8 +32,8 @@ public class RequestParametersHealthCheck { @JsonProperty("vnf-name") private String vnfName; -@JsonProperty("vnf-host-ip-address") -private String vnfHostIpAddress; +@JsonProperty("host-ip-address") +private String hostIpAddress; @JsonProperty("vnf-name") public String getVnfName() { @@ -45,14 +45,14 @@ public void setVnfName(String vnfName) { this.vnfName = vnfName; } -@JsonProperty("vnf-host-ip-address") -public void setVnfHostIpAddress(String vnfHostIpAddress) { - this.vnfHostIpAddress = vnfHostIpAddress; +@JsonProperty("host-ip-address") +public void setHostIpAddress(String hostIpAddress) { + this.hostIpAddress = hostIpAddress; } -@JsonProperty("vnf-host-ip-address") -public String getVnfHostIpAddress() { - return vnfHostIpAddress; +@JsonProperty("host-ip-address") +public String getHostIpAddress() { + return hostIpAddress; } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index 6c399ddbbb..d463fde09c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -347,7 +347,7 @@ public class BBInputSetupMapperLayer { protected OrchestrationContext mapOrchestrationContext(RequestDetails requestDetails) { OrchestrationContext context = new OrchestrationContext(); - context.setIsRollbackEnabled((requestDetails.getRequestInfo().getSuppressRollback())); + context.setIsRollbackEnabled(!(requestDetails.getRequestInfo().getSuppressRollback())); return context; } diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcessTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcessTest.groovy index 8ac8f25eb1..4b0c33ab99 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcessTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcessTest.groovy @@ -57,6 +57,19 @@ class CompleteMsoProcessTest { <sdncadapterworkflow:mso-bpel-name>UCPELayer3ServiceActivateV1</sdncadapterworkflow:mso-bpel-name> </sdncadapterworkflow:MsoCompletionRequest> """ + + private String completeMsoNetworkProcessRequest = """ + <aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:ns="http://org.onap/so/request/types/v1"> + <request-info xmlns="http://org.onap/so/infra/vnf-request/v1"> + <request-id>bd631913-cfc6-488b-ba22-6b98504f703d</request-id> + <action>CREATE</action> + <source>VID</source> + </request-info> + <aetgt:status-message>Resource Completed Successfully</aetgt:status-message> + <aetgt:networkId>bd631913-cfc6-488b-ba22-6b98504f703d</aetgt:networkId> + <aetgt:mso-bpel-name>BPMN Network action: CREATE</aetgt:mso-bpel-name> + </aetgt:MsoCompletionRequest>""" @Test public void testPreProcessRequest() { @@ -117,7 +130,7 @@ class CompleteMsoProcessTest { <statusMessage>Resource Completed Successfully</statusMessage> <requestStatus>COMPLETE</requestStatus> <progress>100</progress> - + <networkId>bd631913-cfc6-488b-ba22-6b98504f703d</networkId> </req:updateInfraRequest> </soapenv:Body> </soapenv:Envelope>""" @@ -130,6 +143,7 @@ class CompleteMsoProcessTest { when(mockExecution.getVariable("CMSO_mso-bpel-name")).thenReturn("BPEL") when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC"); when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); + when(mockExecution.getVariable("CompleteMsoProcessRequest")).thenReturn(completeMsoNetworkProcessRequest); CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess() completeMsoProcess.setUpdateDBstatustoSuccessPayload(mockExecution) diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java index a08d8ca25d..20c69fafe3 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java @@ -66,8 +66,8 @@ public class PayloadClientTest { @Test public void healthCheckFormatTest() throws Exception { - String payloadResult = "{\\\"request-parameters\\\":{\\\"vnf-host-ip-address\\\":\\\"vnfHostIpAddress1\\\"}}"; - Optional<String> payloadClient = PayloadClient.healthCheckFormat("vnfName1", "vnfHostIpAddress1"); + String payloadResult = "{\"request-parameters\":{\"host-ip-address\":\"hostIpAddress1\"}}"; + Optional<String> payloadClient = PayloadClient.healthCheckFormat("vnfName1", "hostIpAddress1"); assertEquals(payloadResult, payloadClient.get()); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java index e5138b394c..94dbbf427c 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java @@ -549,7 +549,7 @@ public class BBInputSetupMapperLayerTest { @Test public void testMapOrchestrationContext() throws IOException { OrchestrationContext expected = new OrchestrationContext(); - expected.setIsRollbackEnabled(false); + expected.setIsRollbackEnabled(true); RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json index d3698771bf..60dd880040 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json @@ -10,7 +10,7 @@ "configurationParameters": [] }, "orchContext": { - "is-rollback-enabled": true + "is-rollback-enabled": false }, "cloudRegion": { "lcp-cloud-region-id" : "myRegionId", |