diff options
7 files changed, 327 insertions, 75 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java new file mode 100644 index 0000000000..9677d0ee1c --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java @@ -0,0 +1,30 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.cloud;
+
+/**
+ * This interface provides the method signature for mapping registration.
+ * All mappings should be registered by the implementing class.
+ */
+@FunctionalInterface
+public interface CloudConfigIdentityMapper {
+
+ public void registerAllMappings();
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/CloudConfigInitializer.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/CloudConfigInitializer.java new file mode 100644 index 0000000000..43a6171699 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/CloudConfigInitializer.java @@ -0,0 +1,97 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.openstack.utils; + + +import javax.ejb.EJB; +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; +import javax.servlet.annotation.WebListener; + +import org.openecomp.mso.cloud.CloudConfigFactory; +import org.openecomp.mso.cloud.CloudConfigIdentityMapper; +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoLogger; + +/** + * This class will attempt to initialize Cloud Config when part of a web application. + * + * + * + */ +@WebListener +public class CloudConfigInitializer implements ServletContextListener +{ + + private CloudConfigFactory cloudConfigFactory=new CloudConfigFactory(); + + public CloudConfigInitializer () { + } + + @Override + public void contextDestroyed(ServletContextEvent event) { + // Nothing to do... + } + + + @Override + public void contextInitialized(ServletContextEvent event) + { + + // Note - this logger may be before or after MSO Logging configuration applied + MsoLogger initLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL); + try { + // Look first in the init-parameters + String msoPropConfigParam = event.getServletContext().getInitParameter("mso.cloud_config.configuration"); + + String[] configFileSplit = msoPropConfigParam.split(","); + for (String msoPropConfig:configFileSplit) { + String[] msoPropDecoded = msoPropConfig.split("="); + + try { + cloudConfigFactory.initializeCloudConfig(msoPropDecoded[0], Integer.valueOf(msoPropDecoded[1])); + initLogger.info(MessageEnum.RA_CONFIG_LOAD, msoPropDecoded[0], "", ""); + initLogger.debug("Mso properties successfully loaded:"+msoPropDecoded[0]+"(Timer(mins):"+Integer.valueOf(msoPropDecoded[1])); + } catch (NumberFormatException ne) { + initLogger.error(MessageEnum.RA_CONFIG_EXC, msoPropDecoded[0] + ". MSO Properties failed due to conversion error (in web.xml file)", "", "", MsoLogger.ErrorCode.DataError, "MSO Properties failed due to conversion error (in web.xml file)", ne); + } + } + + // Second, obtain class name that will register all mappings + String msoMapperClassParam = event.getServletContext().getInitParameter("mso.cloud_config.mapper.class"); + if (msoMapperClassParam != null) { + Class<?> mapperClass = Class.forName(msoMapperClassParam); + if (CloudConfigIdentityMapper.class.isAssignableFrom(mapperClass)) { + ((CloudConfigIdentityMapper)mapperClass.newInstance()).registerAllMappings(); + initLogger.info(MessageEnum.RA_CONFIG_LOAD,msoMapperClassParam+"(Openstack authentication mapper class)","",""); + } else { + initLogger.info(MessageEnum.RA_CONFIG_LOAD,msoMapperClassParam+"(Openstack authentication mapper class not an implementation of CloudConfigIdentityMapper)","",""); + } + } else { + initLogger.info(MessageEnum.RA_CONFIG_LOAD,"Openstack authentication mapper class not specified in web.xml (ONLY core authentication mechanisms will be loaded)","",""); + } + + } + catch (Exception e) { + initLogger.error(MessageEnum.RA_CONFIG_EXC, "Unknown. MSO Properties failed to initialize completely", "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception - MSO Properties failed to initialize completely", e); + } + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy index 3943e30211..9a12a699f9 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy @@ -83,7 +83,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { String resourceModelName = resourceInputObj.getResourceModelInfo().getModelName() //For sdnc requestAction default is "NetworkInstance" String operationType = "Network" - if(!StringUtils.isBlank(recipeParamsFromRequest)){ + if(!StringUtils.isBlank(recipeParamsFromRequest) && "null" != recipeParamsFromRequest){ //the operationType from worflow(first node) is second priority. operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") } @@ -227,13 +227,13 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() - String ServiceInstanceId = resourceInputObj.getServiceInstanceId() + String serviceInstanceId = resourceInputObj.getServiceInstanceId() String operationId = resourceInputObj.getOperationId() String progress = "20" String status = "processing" String statusDescription = "SDCN resource delete invoked" - execution.getVariable("operationId") + //String operationId = execution.getVariable("operationId") String body = """ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" @@ -245,7 +245,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { <operationId>${operationId}</operationId> <progress>${progress}</progress> <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID> - <serviceId>${ServiceInstanceId}</serviceId> + <serviceId>${serviceInstanceId}</serviceId> <status>${status}</status> <statusDescription>${statusDescription}</statusDescription> </ns:updateResourceOperationStatus> @@ -256,17 +256,17 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { } - public void prepareUpdateAfterDeleteSDNCResource(execution) { + public void prepareUpdateAfterDeleteSDNCResource(DelegateExecution execution) { ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() - String ServiceInstanceId = resourceInputObj.getServiceInstanceId() + String serviceInstanceId = resourceInputObj.getServiceInstanceId() String operationId = resourceInputObj.getOperationId() String progress = "100" String status = "finished" String statusDescription = "SDCN resource delete completed" - execution.getVariable("operationId") + //String operationId = execution.getVariable("operationId") String body = """ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" @@ -278,7 +278,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { <operationId>${operationId}</operationId> <progress>${progress}</progress> <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID> - <serviceId>${ServiceInstanceId}</serviceId> + <serviceId>${serviceInstanceId}</serviceId> <status>${status}</status> <statusDescription>${statusDescription}</statusDescription> </ns:updateResourceOperationStatus> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy index 92e7fdded5..8e05f8d3b8 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy @@ -273,7 +273,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { utils.log("INFO", "======== COMPLETED parseNextResource Process ======== ", isDebugEnabled) } - public void prepareFinishedProgressForResource(execution) { + public void prepareFinishedProgressForResource(DelegateExecution execution) { String serviceInstanceId = execution.getVariable("serviceInstanceId") String serviceType = execution.getVariable("serviceType") @@ -297,7 +297,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { <operationId>${operationId}</operationId> <progress>${progress}</progress> <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID> - <serviceId>${ServiceInstanceId}</serviceId> + <serviceId>${serviceInstanceId}</serviceId> <status>${status}</status> <statusDescription>${statusDescription}</statusDescription> </ns:updateResourceOperationStatus> @@ -309,20 +309,84 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { execution.setVariable("CVFMI_updateResOperStatusRequest", body) } - public void prepareServiceTopologyDeletion(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** prepareServiceTopologyDeletion " + " *****", isDebugEnabled) - - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - execution.setVariable("modelInvariantUuid", serviceDecomposition.getModelInfo().getModelInvariantUuid()) - execution.setVariable("modelVersion", serviceDecomposition.getModelInfo().getModelVersion()) - execution.setVariable("modelUuid", serviceDecomposition.getModelInfo().getModelUuid()) - execution.setVariable("serviceModelName", serviceDecomposition.getModelInfo().getModelName()) + public void prepareSDNCServiceDeactivateRequest (DelegateExecution execution) { + prepareSDNCServiceRequest (execution, "deactivate") + } + + public void prepareSDNCServiceDeleteRequest (DelegateExecution execution) { + prepareSDNCServiceRequest (execution, "delete") + } + + public void prepareSDNCServiceRequest (DelegateExecution execution, String svcAction) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started prepareSDNCServiceRequest for " + svcAction + "*****", isDebugEnabled) - // set operation type and resource type is required to form request body - execution.setVariable("operationType", "DELETE") - execution.setVariable("resourceType", "SDNC-SERVICE-TOPOLOGY") + try { + // get variables + String sdnc_svcAction = svcAction + String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + String hdrRequestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String source = execution.getVariable("source") + String sdnc_service_id = serviceInstanceId + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + String serviceType = execution.getVariable("serviceType") + String globalCustomerId = execution.getVariable("globalSubscriberId") + String serviceModelInvariantUuid = serviceDecomposition.getModelInfo().getModelInvariantUuid() + String serviceModelUuid = serviceDecomposition.getModelInfo().getModelUuid() + String serviceModelVersion = serviceDecomposition.getModelInfo().getModelVersion() + String serviceModelName = serviceDecomposition.getModelInfo().getModelName() + + // 1. prepare assign topology via SDNC Adapter SUBFLOW call + String sndcTopologyDeleteRequest = + """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" + xmlns:sdncadapter="http://org.openecomp.mso/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${hdrRequestId}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${serviceInstanceId}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${sdnc_svcAction}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${hdrRequestId}</request-id> + <request-action>DeleteServiceInstance</request-action> + <source>${source}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${serviceInstanceId}</service-id> + <subscription-service-type>${serviceType}</subscription-service-type> + <onap-model-information> + <model-invariant-uuid>${serviceModelInvariantUuid}</model-invariant-uuid> + <model-uuid>${serviceModelUuid}</model-uuid> + <model-version>${serviceModelVersion}</model-version> + <model-name>${serviceModelName}</model-name> + </onap-model-information> + <service-instance-id>${serviceInstanceId}</service-instance-id> + <global-customer-id>${globalCustomerId}</global-customer-id> + </service-information> + <service-request-input> + </service-request-input> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + + String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) + utils.logAudit(sndcTopologyDeleteRequesAsString) + execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString) + utils.log("INFO","sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoDeleteResourcesV1 flow. prepareSDNCServiceRequest() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - utils.log("INFO"," ***** prepareServiceTopologyDeletion " + " *****", isDebugEnabled) - } + } + utils.log("INFO","***** Exit prepareSDNCServiceRequest for " + svcAction + "*****", isDebugEnabled) + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn index b74c169d26..24f16817c4 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="DoDeleteResourcesV1" name="DoDeleteResourcesV1" isExecutable="true"> <bpmn:startEvent id="StartEvent_1" name="Start Resource Delete"> <bpmn:outgoing>SequenceFlow_0stqur4</bpmn:outgoing> @@ -57,10 +57,6 @@ ex.processJavaException(execution)]]></bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_0rkycoj" name="" sourceRef="StartEvent_1cjikl5" targetRef="ScriptTask_0plexin" /> <bpmn:sequenceFlow id="SequenceFlow_117fiux" name="" sourceRef="ScriptTask_0plexin" targetRef="EndEvent_0gh3mcj" /> </bpmn:subProcess> - <bpmn:serviceTask id="ServiceTask_176j3rl" name="Call Delete SDNC Service Topology" camunda:class="org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.SdncServiceTopologyOperationTask"> - <bpmn:incoming>SequenceFlow_11h5pba</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_174yrgl</bpmn:outgoing> - </bpmn:serviceTask> <bpmn:exclusiveGateway id="ExclusiveGateway_1x63i6w" name="Is SDNC Service Contained"> <bpmn:incoming>SequenceFlow_1yrkxjm</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1s1nnmj</bpmn:outgoing> @@ -73,7 +69,6 @@ ex.processJavaException(execution)]]></bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_1s1nnmj" name="yes" sourceRef="ExclusiveGateway_1x63i6w" targetRef="prepareSDNCServiceTopologyDelete"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("isContainsWanResource" ) == "true" )}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_174yrgl" sourceRef="ServiceTask_176j3rl" targetRef="ExclusiveGateway_1jybr0n" /> <bpmn:sequenceFlow id="SequenceFlow_0lk19rm" name="no" sourceRef="ExclusiveGateway_1x63i6w" targetRef="ExclusiveGateway_1jybr0n"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("isContainsWanResource" ) == "false" )}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> @@ -87,8 +82,8 @@ ex.processJavaException(execution)]]></bpmn:script> <bpmn:linkEventDefinition name="DeleteSDNCServiceTopology" /> </bpmn:intermediateCatchEvent> <bpmn:exclusiveGateway id="ExclusiveGateway_1jybr0n"> - <bpmn:incoming>SequenceFlow_174yrgl</bpmn:incoming> <bpmn:incoming>SequenceFlow_0lk19rm</bpmn:incoming> + <bpmn:incoming>SequenceFlow_14fx6hv</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0o21fg8</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_0o21fg8" sourceRef="ExclusiveGateway_1jybr0n" targetRef="EndEvent_17bzayo" /> @@ -148,14 +143,50 @@ dcsi.prepareFinishedProgressForResource(execution)]]></bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_11bgbsh" sourceRef="ScriptTask_0shhhxr" targetRef="ServiceTask_1bw1mjh" /> <bpmn:sequenceFlow id="SequenceFlow_19ccmqv" name="no" sourceRef="ExclusiveGateway_0khn1my" targetRef="ScriptTask_0shhhxr" /> <bpmn:sequenceFlow id="SequenceFlow_0djplpd" sourceRef="ServiceTask_1bw1mjh" targetRef="ScriptTask_1gf78zz" /> - <bpmn:sequenceFlow id="SequenceFlow_11h5pba" sourceRef="prepareSDNCServiceTopologyDelete" targetRef="ServiceTask_176j3rl" /> - <bpmn:scriptTask id="prepareSDNCServiceTopologyDelete" name="Prepare SDNC service Topology Delete" scriptFormat="groovy"> + <bpmn:sequenceFlow id="SequenceFlow_11h5pba" sourceRef="prepareSDNCServiceTopologyDelete" targetRef="CallActivity_1ueonyc" /> + <bpmn:scriptTask id="prepareSDNCServiceTopologyDelete" name="Prepare SDNC service Topology Deactivate" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1s1nnmj</bpmn:incoming> <bpmn:outgoing>SequenceFlow_11h5pba</bpmn:outgoing> <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* def ddr = new DoDeleteResourcesV1() -ddr.prepareServiceTopologyDeletion(execution)]]></bpmn:script> +ddr.prepareSDNCServiceDeactivateRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_1ueonyc" name="Call SDNC RSRC Adapter V1 " calledElement="sdncAdapter"> + <bpmn:extensionElements> + <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> + <camunda:in source="msoRequestId" target="mso-request-id" /> + <camunda:in source="serviceInstanceId" target="mso-service-instance-id" /> + <camunda:out source="sdncAdapterResponse" target="DELSDNCRES_activateSDNCResponse" /> + <camunda:out source="SDNCA_ResponseCode" target="DELSDNCRES_sdncDeleteReturnCode" /> + <camunda:out source="SDNCA_SuccessIndicator" target="DELSDNCRES_SuccessIndicator" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_11h5pba</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0gqlayv</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0gqlayv" sourceRef="CallActivity_1ueonyc" targetRef="ScriptTask_0k6kwv7" /> + <bpmn:callActivity id="CallActivity_0zuhttc" name="Call SDNC RSRC Adapter V1 " calledElement="sdncAdapter"> + <bpmn:extensionElements> + <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> + <camunda:in source="msoRequestId" target="mso-request-id" /> + <camunda:in source="serviceInstanceId" target="mso-service-instance-id" /> + <camunda:out source="sdncAdapterResponse" target="DELSDNCRES_activateSDNCResponse" /> + <camunda:out source="SDNCA_ResponseCode" target="DELSDNCRES_sdncDeleteReturnCode" /> + <camunda:out source="SDNCA_SuccessIndicator" target="DELSDNCRES_SuccessIndicator" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0etaubw</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_14fx6hv</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_14fx6hv" sourceRef="CallActivity_0zuhttc" targetRef="ExclusiveGateway_1jybr0n" /> + <bpmn:scriptTask id="ScriptTask_0k6kwv7" name="Prepare SDNC service Topology Delete" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0gqlayv</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0etaubw</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def ddr = new DoDeleteResourcesV1() +ddr.prepareSDNCServiceDeleteRequest(execution)]]></bpmn:script> </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0etaubw" sourceRef="ScriptTask_0k6kwv7" targetRef="CallActivity_0zuhttc" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeleteResourcesV1"> @@ -249,9 +280,6 @@ ddr.prepareServiceTopologyDeletion(execution)]]></bpmn:script> <dc:Bounds x="639.5" y="887" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_176j3rl_di" bpmnElement="ServiceTask_176j3rl"> - <dc:Bounds x="689" y="566" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1x63i6w_di" bpmnElement="ExclusiveGateway_1x63i6w" isMarkerVisible="true"> <dc:Bounds x="396" y="581" width="50" height="50" /> <bpmndi:BPMNLabel> @@ -266,32 +294,25 @@ ddr.prepareServiceTopologyDeletion(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_17bzayo_di" bpmnElement="EndEvent_17bzayo"> - <dc:Bounds x="992.2009291521485" y="588" width="36" height="36" /> + <dc:Bounds x="1194" y="588" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="977" y="628" width="72" height="24" /> + <dc:Bounds x="1181" y="628" width="68" height="28" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1s1nnmj_di" bpmnElement="SequenceFlow_1s1nnmj"> <di:waypoint xsi:type="dc:Point" x="446" y="606" /> - <di:waypoint xsi:type="dc:Point" x="525" y="606" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="476" y="585" width="20" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_174yrgl_di" bpmnElement="SequenceFlow_174yrgl"> - <di:waypoint xsi:type="dc:Point" x="789" y="606" /> - <di:waypoint xsi:type="dc:Point" x="827" y="606" /> + <di:waypoint xsi:type="dc:Point" x="509" y="606" /> <bpmndi:BPMNLabel> - <dc:Bounds x="763" y="585" width="90" height="12" /> + <dc:Bounds x="468.8987341772152" y="585" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0lk19rm_di" bpmnElement="SequenceFlow_0lk19rm"> <di:waypoint xsi:type="dc:Point" x="421" y="631" /> <di:waypoint xsi:type="dc:Point" x="421" y="721" /> - <di:waypoint xsi:type="dc:Point" x="852" y="721" /> - <di:waypoint xsi:type="dc:Point" x="852" y="631" /> + <di:waypoint xsi:type="dc:Point" x="1130" y="721" /> + <di:waypoint xsi:type="dc:Point" x="1130" y="631" /> <bpmndi:BPMNLabel> - <dc:Bounds x="629" y="700" width="15" height="12" /> + <dc:Bounds x="770.322505800464" y="700" width="12" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1d5mzit_di" bpmnElement="SequenceFlow_1d5mzit"> @@ -314,16 +335,16 @@ ddr.prepareServiceTopologyDeletion(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1jybr0n_di" bpmnElement="ExclusiveGateway_1jybr0n" isMarkerVisible="true"> - <dc:Bounds x="827" y="581" width="50" height="50" /> + <dc:Bounds x="1105" y="581" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="815" y="635" width="75" height="24" /> + <dc:Bounds x="1086" y="635" width="90" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0o21fg8_di" bpmnElement="SequenceFlow_0o21fg8"> - <di:waypoint xsi:type="dc:Point" x="877" y="606" /> - <di:waypoint xsi:type="dc:Point" x="992" y="606" /> + <di:waypoint xsi:type="dc:Point" x="1155" y="606" /> + <di:waypoint xsi:type="dc:Point" x="1194" y="606" /> <bpmndi:BPMNLabel> - <dc:Bounds x="934.5" y="585" width="0" height="12" /> + <dc:Bounds x="1129.5" y="585" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_12460xo_di" bpmnElement="ScriptTask_12460xo"> @@ -390,15 +411,45 @@ ddr.prepareServiceTopologyDeletion(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_11h5pba_di" bpmnElement="SequenceFlow_11h5pba"> - <di:waypoint xsi:type="dc:Point" x="625" y="606" /> - <di:waypoint xsi:type="dc:Point" x="689" y="606" /> + <di:waypoint xsi:type="dc:Point" x="609" y="606" /> + <di:waypoint xsi:type="dc:Point" x="654" y="606" /> <bpmndi:BPMNLabel> - <dc:Bounds x="657" y="585" width="0" height="12" /> + <dc:Bounds x="586.5" y="585" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0va5zgp_di" bpmnElement="prepareSDNCServiceTopologyDelete"> - <dc:Bounds x="525" y="566" width="100" height="80" /> + <dc:Bounds x="509" y="566" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1ueonyc_di" bpmnElement="CallActivity_1ueonyc"> + <dc:Bounds x="654" y="566" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0gqlayv_di" bpmnElement="SequenceFlow_0gqlayv"> + <di:waypoint xsi:type="dc:Point" x="754" y="606" /> + <di:waypoint xsi:type="dc:Point" x="789" y="606" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="771.5" y="584" width="0" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0zuhttc_di" bpmnElement="CallActivity_0zuhttc"> + <dc:Bounds x="936" y="566" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_14fx6hv_di" bpmnElement="SequenceFlow_14fx6hv"> + <di:waypoint xsi:type="dc:Point" x="1036" y="606" /> + <di:waypoint xsi:type="dc:Point" x="1105" y="606" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1070.5" y="584" width="0" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0k6kwv7_di" bpmnElement="ScriptTask_0k6kwv7"> + <dc:Bounds x="789" y="566" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0etaubw_di" bpmnElement="SequenceFlow_0etaubw"> + <di:waypoint xsi:type="dc:Point" x="889" y="606" /> + <di:waypoint xsi:type="dc:Point" x="936" y="606" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="912.5" y="584" width="0" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequest.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequest.java index a894ffca16..d06c532f88 100644 --- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequest.java +++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequest.java @@ -41,6 +41,8 @@ public class ServiceInstancesRequest implements Serializable { private String vfModuleInstanceId; @JsonProperty("configurationId") private String configurationId; + @JsonProperty("correlationId") + private String correlationId; public RequestDetails getRequestDetails() { return requestDetails; @@ -98,15 +100,26 @@ public class ServiceInstancesRequest implements Serializable { this.configurationId = configurationId; } + public String getCorrelationId() { + return correlationId; + } + + public void setCorrelationId(String correlationId) { + this.correlationId = correlationId; + } + @Override public String toString() { - return "ServiceInstancesRequest [requestDetails=" + requestDetails - + ", serviceInstanceId=" + serviceInstanceId - + ", vnfInstanceId=" + vnfInstanceId + ", networkInstanceId=" - + networkInstanceId + ", volumeGroupInstanceId=" - + volumeGroupInstanceId + ", vfModuleInstanceId=" - + vfModuleInstanceId + ", configurationId=" - + configurationId + ",]"; + final StringBuilder sb = new StringBuilder("ServiceInstancesRequest{"); + sb.append("requestDetails=").append(requestDetails); + sb.append(", serviceInstanceId='").append(serviceInstanceId).append('\''); + sb.append(", vnfInstanceId='").append(vnfInstanceId).append('\''); + sb.append(", networkInstanceId='").append(networkInstanceId).append('\''); + sb.append(", volumeGroupInstanceId='").append(volumeGroupInstanceId).append('\''); + sb.append(", vfModuleInstanceId='").append(vfModuleInstanceId).append('\''); + sb.append(", configurationId='").append(configurationId).append('\''); + sb.append(", correlationId='").append(correlationId).append('\''); + sb.append('}'); + return sb.toString(); } - } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java index fc8e8d9d6a..7c3a3df0e2 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java @@ -77,7 +77,6 @@ import com.wordnik.swagger.annotations.ApiOperation; @Api(value="/serviceInstances",description="API Requests for Service Instances") public class ServiceInstances { - private HashMap<String, String> instanceIdMap = new HashMap<>(); private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); @@ -508,7 +507,7 @@ public class ServiceInstances { MsoRequest msoRequest = new MsoRequest (requestId); try { - sir = convertJsonToServiceInstanceRequest(requestJSON, action, startTime, sir, msoRequest); + sir = convertJsonToServiceInstanceRequest(requestJSON, action, startTime, msoRequest); } catch(Exception e) { msoLogger.debug("Exception occurred while mapping of request to JSON object ", e); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, @@ -907,11 +906,10 @@ public class ServiceInstances { } private ServiceInstancesRequest convertJsonToServiceInstanceRequest(String requestJSON, Action action, long startTime, - ServiceInstancesRequest sir, MsoRequest msoRequest) throws Exception { + MsoRequest msoRequest) throws Exception { try{ ObjectMapper mapper = new ObjectMapper(); - sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); - + return mapper.readValue(requestJSON, ServiceInstancesRequest.class); } catch(Exception e){ msoLogger.debug ("Mapping of request to JSON object failed : ", e); if (msoRequest.getRequestId () != null) { @@ -922,7 +920,6 @@ public class ServiceInstances { msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed"); throw new Exception(e); } - return sir; } private RecipeLookupResult getServiceInstanceOrchestrationURI (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { @@ -1233,7 +1230,7 @@ public class ServiceInstances { MsoRequest msoRequest = new MsoRequest (requestId); try { - sir = convertJsonToServiceInstanceRequest(requestJSON, action, startTime, sir, msoRequest); + sir = convertJsonToServiceInstanceRequest(requestJSON, action, startTime, msoRequest); } catch(Exception e) { Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(), |