diff options
Diffstat (limited to 'bpmn/mso-infrastructure-bpmn/src/main')
47 files changed, 9240 insertions, 0 deletions
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy b/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy new file mode 100644 index 0000000000..9262954917 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.bpmn.infrastructure.scripts + +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils + +/** + * This groovy class supports the <class>ActivateSDNCCNetworkResource.bpmn</class> process. + * flow for SDNC Network Resource Activate + */ +public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { + + String Prefix = "ACTSDNCRES_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + public void preProcessRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started preProcessRequest *****", isDebugEnabled) + } + + public void prepareUpdateAfterActivateSDNCResource(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** started prepareUpdateAfterActivateSDNCResource *****", isDebugEnabled) + } + + public void postCreateSDNCCall(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** started postCreateSDNCCall *****", isDebugEnabled) + } + + public void sendSyncResponse(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** started sendSyncResponse *****", isDebugEnabled) + } +}
\ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateActivateSDNCResource.groovy b/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateActivateSDNCResource.groovy new file mode 100644 index 0000000000..bb58030683 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateActivateSDNCResource.groovy @@ -0,0 +1,425 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.onap.so.bpmn.infrastructure.scripts + +import org.json.JSONObject +import org.json.XML; + +import static org.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.recipe.ResourceInput; +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder +import org.onap.so.rest.APIResponse +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory +import java.util.UUID; + +import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig + +/** + * This groovy class supports the <class>CreateActivateSDNCResource.bpmn</class> process. + * flow for SDNC Network Resource Create + */ +public class CreateActivateSDNCResource extends AbstractServiceTaskProcessor { + + String Prefix="CRESDNCRES_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + public void preProcessRequest(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started preProcessRequest *****", isDebugEnabled) + try { + + //get bpmn inputs from resource request. + String requestId = execution.getVariable("mso-request-id") + String requestAction = execution.getVariable("requestAction") + utils.log("INFO","The requestAction is: " + requestAction, isDebugEnabled) + String recipeParamsFromRequest = execution.getVariable("recipeParams") + utils.log("INFO","The recipeParams is: " + recipeParamsFromRequest, isDebugEnabled) + String resourceInput = execution.getVariable("resourceInput") + utils.log("INFO","The resourceInput is: " + resourceInput, isDebugEnabled) + //Get ResourceInput Object + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) + execution.setVariable(Prefix + "resourceInput", resourceInputObj) + + //Deal with recipeParams + String recipeParamsFromWf = execution.getVariable("recipeParamXsd") + String resourceName = resourceInputObj.getResourceInstanceName() + //For sdnc requestAction default is "createNetworkInstance" + String operationType = "Network" + String apiType = "network" + if(!StringUtils.isBlank(recipeParamsFromRequest)){ + //the operationType from worflow(first node) is second priority. + operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") + apiType = jsonUtil.getJsonValue(recipeParamsFromRequest, "apiType") + } + if(!StringUtils.isBlank(recipeParamsFromWf)){ + //the operationType from worflow(first node) is highest priority. + operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") + apiType = jsonUtil.getJsonValue(recipeParamsFromRequest, "apiType") + } + + execution.setVariable(Prefix + "operationType", operationType) + execution.setVariable(Prefix + "apiType", apiType) + execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) + execution.setVariable("mso-request-id", requestId) + execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) + //TODO Here build networkrequest + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + String msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + String customizeResourceParam(String netowrkInputParametersJson) { + List<Map<String, Object>> paramList = new ArrayList(); + JSONObject jsonObject = new JSONObject(netowrkInputParametersJson); + Iterator iterator = jsonObject.keys(); + while (iterator.hasNext()) { + String key = iterator.next(); + HashMap<String, String> hashMap = new HashMap(); + hashMap.put("name", key); + hashMap.put("value", jsonObject.get(key)) + paramList.add(hashMap) + } + Map<String, List<Map<String, Object>>> paramMap = new HashMap(); + paramMap.put("param", paramList); + + return new JSONObject(paramMap).toString(); + } + + public void prepareSDNCRequest (DelegateExecution execution) { + String svcAction = "create" + prepareSDNCRequestReq(execution, svcAction, "") + } + + + public void prepareSDNCActivateRequest (DelegateExecution execution) { + String svcAction = "activate" + String sndcResourceId = execution.getVariable(Prefix + "sdncResourceId") + prepareSDNCRequestReq(execution, svcAction, sndcResourceId) + } + /** + * Pre Process the BPMN Flow Request + * Inclouds: + * generate the nsOperationKey + * generate the nsParameters + */ + public void prepareSDNCRequestReq (DelegateExecution execution, String svcAction, String sdncResourceId) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started prepareSDNCRequest *****", isDebugEnabled) + + try { + // get variables + String operationType = execution.getVariable(Prefix + "operationType") + String sdnc_apiType = execution.getVariable(Prefix + "apiType") + String sdnc_svcAction = svcAction + String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" + + String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + + String hdrRequestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") + String source = execution.getVariable("source") + String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String serviceType = resourceInputObj.getServiceType() + String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() + String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid() + String serviceModelVersion = resourceInputObj.getServiceModelInfo().getModelVersion() + String serviceModelName = resourceInputObj.getServiceModelInfo().getModelName() + String globalCustomerId = resourceInputObj.getGlobalSubscriberId() + String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid(); + String modelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion() + String resourceInputPrameters = resourceInputObj.getResourceParameters() + String netowrkInputParametersJson = jsonUtil.getJsonValue(resourceInputPrameters, "requestInputs") + //here convert json string to xml string + String netowrkInputParameters = XML.toString(new JSONObject(customizeResourceParam(netowrkInputParametersJson))) + + // 1. prepare assign topology via SDNC Adapter SUBFLOW call + String sndcTopologyCreateRequest = + """<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>${sdnc_apiType}-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>${sdnc_requestAction}</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> + <${sdnc_apiType}-information> + <${sdnc_apiType}-id>${sdncResourceId}</${sdnc_apiType}-id> + <onap-model-information> + <model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid> + <model-customization-uuid>${modelCustomizationUuid}</model-customization-uuid> + <model-uuid>${modelUuid}</model-uuid> + <model-version>${modelVersion}</model-version> + <model-name>${modelName}</model-name> + </onap-model-information> + </${sdnc_apiType}-information> + <${sdnc_apiType}-request-input> + <${sdnc_apiType}-input-parameters>${netowrkInputParameters}</${sdnc_apiType}-input-parameters> + </${sdnc_apiType}-request-input> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + + String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) + utils.logAudit(sndcTopologyCreateRequesAsString) + execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString) + utils.log("INFO","sdncAdapterWorkflowRequest :" + sndcTopologyCreateRequesAsString, isDebugEnabled) + utils.log("DEBUG","sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString, isDebugEnabled) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in CreateSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled) + } + + private void setProgressUpdateVariables(DelegateExecution execution, String body) { + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + execution.setVariable("CVFMI_updateResOperStatusRequest", body) + } + + public void prepareUpdateBeforeCreateSDNCResource(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started prepareUpdateBeforeCreateSDNCResource *****", isDebugEnabled) + + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String operType = resourceInputObj.getOperationType() + String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String ServiceInstanceId = resourceInputObj.getServiceInstanceId() + String operationId = resourceInputObj.getOperationId() + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + String progress = "20" + String status = "processing" + String statusDescription = "Create " + modelName + + execution.getVariable("operationId") + + String body = """ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.openecomp.mso/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:updateResourceOperationStatus> + <operType>${operType}</operType> + <operationId>${operationId}</operationId> + <progress>${progress}</progress> + <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID> + <serviceId>${ServiceInstanceId}</serviceId> + <status>${status}</status> + <statusDescription>${statusDescription}</statusDescription> + </ns:updateResourceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>"""; + + setProgressUpdateVariables(execution, body) + utils.log("INFO"," ***** End prepareUpdateBeforeCreateSDNCResource *****", isDebugEnabled) + } + + public void postCreateSDNC(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + ServicePluginFactory.getInstance().test() + utils.log("INFO"," ***** Started postCreateSDNC *****", isDebugEnabled) + String sdnc_apiType = execution.getVariable(Prefix + "apiType") + String sdncAdapterResponse = execution.getVariable("sdncAdapterResponse") + utils.log("INFO","sdncAdapterResponse for create:" + sdncAdapterResponse , isDebugEnabled) + sdncAdapterResponse = sdncAdapterResponse.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "") + sdncAdapterResponse = sdncAdapterResponse.replaceAll('tag0:', '').replaceAll(':tag0', '') + utils.log("INFO","sdncAdapterResponse for create after replace:" + sdncAdapterResponse , isDebugEnabled) + //if it is vnf we need to query the vnf-id,if it is network , we need to query the network-id + String sdncRespData = utils.getNodeText1(sdncAdapterResponse, "RequestData") + utils.log("INFO","sdncRespData:" + sdncRespData , isDebugEnabled) + String objectKey = "/" + sdnc_apiType + "/" + String objectDataKey = "/" + sdnc_apiType + "-data/" + String objectPath = utils.getNodeText1(sdncRespData, "object-path") + + String resourceObjId = objectPath.substring(objectPath.indexOf(objectKey) + objectKey.length(), objectPath.indexOf(objectDataKey)) + utils.log("INFO", "resourceObjId:" + resourceObjId, isDebugEnabled) + execution.setVariable(Prefix + "sdncResourceId", resourceObjId) + + utils.log("INFO"," ***** End postCreateSDNC *****", isDebugEnabled) + + } + + public void postActivateSDNC(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started postActivateSDNC *****", isDebugEnabled) + String sdncAdapterResponse = execution.getVariable("sdncAdapterResponse") + utils.log("INFO","sdncAdapterResponse for activate:" + sdncAdapterResponse , isDebugEnabled) + utils.log("INFO"," ***** End postActivateSDNC *****", isDebugEnabled) + } + + public void prepareUpdateAfterCreateSDNCResource(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started prepareUpdateAfterCreateSDNCResource *****", isDebugEnabled) + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String operType = resourceInputObj.getOperationType() + String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String ServiceInstanceId = resourceInputObj.getServiceInstanceId() + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + String operationId = resourceInputObj.getOperationId() + String progress = "50" + String status = "processing" + String statusDescription = "Instantiate " + modelName + + execution.getVariable("operationId") + + String body = """ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.openecomp.mso/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:updateResourceOperationStatus> + <operType>${operType}</operType> + <operationId>${operationId}</operationId> + <progress>${progress}</progress> + <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID> + <serviceId>${ServiceInstanceId}</serviceId> + <status>${status}</status> + <statusDescription>${statusDescription}</statusDescription> + </ns:updateResourceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>"""; + + setProgressUpdateVariables(execution, body) + utils.log("INFO"," ***** End prepareUpdateAfterCreateSDNCResource *****", isDebugEnabled) + } + + public void prepareUpdateAfterActivateSDNCResource(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started prepareUpdateAfterActivateSDNCResource *****", isDebugEnabled) + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String operType = resourceInputObj.getOperationType() + String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String ServiceInstanceId = resourceInputObj.getServiceInstanceId() + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + String operationId = resourceInputObj.getOperationId() + String progress = "100" + String status = "finished" + String statusDescription = "Instantiate " + modelName + " finished" + + execution.getVariable("operationId") + + String body = """ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.openecomp.mso/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:updateResourceOperationStatus> + <operType>${operType}</operType> + <operationId>${operationId}</operationId> + <progress>${progress}</progress> + <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID> + <serviceId>${ServiceInstanceId}</serviceId> + <status>${status}</status> + <statusDescription>${statusDescription}</statusDescription> + </ns:updateResourceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>"""; + + setProgressUpdateVariables(execution, body) + utils.log("INFO"," ***** End prepareUpdateAfterActivateSDNCResource *****", isDebugEnabled) + } + + public void postCreateSDNCCall(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started prepareSDNCRequest *****", isDebugEnabled) + String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode") + String responseObj = execution.getVariable(Prefix + "SuccessIndicator") + + utils.log("INFO","response from sdnc, response code :" + responseCode + " response object :" + responseObj, isDebugEnabled) + utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled) + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) + + try { + String operationStatus = "finished" + // RESTResponse for main flow + String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() + utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) + sendWorkflowResponse(execution, 202, resourceOperationResp) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/CallbackHeader.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/CallbackHeader.java new file mode 100644 index 0000000000..bf4c59ca09 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/CallbackHeader.java @@ -0,0 +1,139 @@ +/*- + * ============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.onap.so.bpmn.common.adapter.sdnc; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="ResponseCode" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="ResponseMessage" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "requestId", + "responseCode", + "responseMessage" +}, namespace="http://org.onap/workflow/sdnc/adapter/schema/v1") +@XmlRootElement(name = "CallbackHeader") +public class CallbackHeader { + + @XmlElement(name = "RequestId", required = true, namespace="http://org.onap/workflow/sdnc/adapter/schema/v1") + protected String requestId; + @XmlElement(name = "ResponseCode", required = true,namespace="http://org.onap/workflow/sdnc/adapter/schema/v1") + protected String responseCode; + @XmlElement(name = "ResponseMessage", required = true,namespace="http://org.onap/workflow/sdnc/adapter/schema/v1") + protected String responseMessage; + + /** + * Gets the value of the requestId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRequestId() { + return requestId; + } + + /** + * Sets the value of the requestId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRequestId(String value) { + this.requestId = value; + } + + /** + * Gets the value of the responseCode property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResponseCode() { + return responseCode; + } + + /** + * Sets the value of the responseCode property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResponseCode(String value) { + this.responseCode = value; + } + + /** + * Gets the value of the responseMessage property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResponseMessage() { + return responseMessage; + } + + /** + * Sets the value of the responseMessage property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResponseMessage(String value) { + this.responseMessage = value; + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactory.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactory.java new file mode 100644 index 0000000000..a72e23e57f --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactory.java @@ -0,0 +1,91 @@ +/*- + * ============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.onap.so.bpmn.common.adapter.sdnc; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the org.openecomp.domain2.workflow.sdnc.adapter.schema.v1 package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.domain2.workflow.sdnc.adapter.schema.v1 + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link RequestHeader } + * + */ + public RequestHeader createRequestHeader() { + return new RequestHeader(); + } + + /** + * Create an instance of {@link SDNCAdapterResponse } + * + */ + public SDNCAdapterResponse createSDNCAdapterResponse() { + return new SDNCAdapterResponse(); + } + + /** + * Create an instance of {@link SDNCAdapterCallbackRequest } + * + */ + public SDNCAdapterCallbackRequest createSDNCAdapterCallbackRequest() { + return new SDNCAdapterCallbackRequest(); + } + + /** + * Create an instance of {@link CallbackHeader } + * + */ + public CallbackHeader createCallbackHeader() { + return new CallbackHeader(); + } + + /** + * Create an instance of {@link SDNCAdapterRequest } + * + */ + public SDNCAdapterRequest createSDNCAdapterRequest() { + return new SDNCAdapterRequest(); + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/RequestHeader.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/RequestHeader.java new file mode 100644 index 0000000000..2c56a110db --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/RequestHeader.java @@ -0,0 +1,223 @@ +/*- + * ============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.onap.so.bpmn.common.adapter.sdnc; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="SvcInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="SvcAction" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="SvcOperation" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="CallbackUrl" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="MsoAction" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "requestId", + "svcInstanceId", + "svcAction", + "svcOperation", + "callbackUrl", + "msoAction" +}) +@XmlRootElement(name = "RequestHeader") +public class RequestHeader { + + @XmlElement(name = "RequestId", required = true) + protected String requestId; + @XmlElement(name = "SvcInstanceId") + protected String svcInstanceId; + @XmlElement(name = "SvcAction", required = true) + protected String svcAction; + @XmlElement(name = "SvcOperation", required = true) + protected String svcOperation; + @XmlElement(name = "CallbackUrl", required = true) + protected String callbackUrl; + @XmlElement(name = "MsoAction") + protected String msoAction; + + /** + * Gets the value of the requestId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRequestId() { + return requestId; + } + + /** + * Sets the value of the requestId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRequestId(String value) { + this.requestId = value; + } + + /** + * Gets the value of the svcInstanceId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSvcInstanceId() { + return svcInstanceId; + } + + /** + * Sets the value of the svcInstanceId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSvcInstanceId(String value) { + this.svcInstanceId = value; + } + + /** + * Gets the value of the svcAction property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSvcAction() { + return svcAction; + } + + /** + * Sets the value of the svcAction property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSvcAction(String value) { + this.svcAction = value; + } + + /** + * Gets the value of the svcOperation property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSvcOperation() { + return svcOperation; + } + + /** + * Sets the value of the svcOperation property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSvcOperation(String value) { + this.svcOperation = value; + } + + /** + * Gets the value of the callbackUrl property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCallbackUrl() { + return callbackUrl; + } + + /** + * Sets the value of the callbackUrl property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCallbackUrl(String value) { + this.callbackUrl = value; + } + + /** + * Gets the value of the msoAction property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMsoAction() { + return msoAction; + } + + /** + * Sets the value of the msoAction property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMsoAction(String value) { + this.msoAction = value; + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java new file mode 100644 index 0000000000..e77232510a --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java @@ -0,0 +1,130 @@ +/*- + * ============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.onap.so.bpmn.common.adapter.sdnc; + +import java.io.StringWriter; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element ref="{http://org.onap/workflow/sdnc/adapter/schema/v1}CallbackHeader"/> + * <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", namespace="http://org.onap/workflow/sdnc/adapter/schema/v1", propOrder = { + "callbackHeader", + "requestData" +}) +@XmlRootElement(name = "SDNCAdapterCallbackRequest", namespace="http://org.onap/workflow/sdnc/adapter/schema/v1") +public class SDNCAdapterCallbackRequest { + + @XmlElement(name = "CallbackHeader", required = true, namespace="http://org.onap/workflow/sdnc/adapter/schema/v1") + protected CallbackHeader callbackHeader; + @XmlElement(name = "RequestData", required=false, namespace="http://org.onap/workflow/sdnc/adapter/schema/v1") + protected Object requestData; + + /** + * Gets the value of the callbackHeader property. + * + * @return + * possible object is + * {@link CallbackHeader } + * + */ + public CallbackHeader getCallbackHeader() { + return callbackHeader; + } + + /** + * Sets the value of the callbackHeader property. + * + * @param value + * allowed object is + * {@link CallbackHeader } + * + */ + public void setCallbackHeader(CallbackHeader value) { + this.callbackHeader = value; + } + + /** + * Gets the value of the requestData property. + * + * @return + * possible object is + * {@link Object } + * + */ + public Object getRequestData() { + return requestData; + } + + /** + * Sets the value of the requestData property. + * + * @param value + * allowed object is + * {@link Object } + * + */ + public void setRequestData(Object value) { + this.requestData = value; + } + + @Override + public String toString() { + StringWriter writer = new StringWriter(); + try { + JAXBContext context = JAXBContext + .newInstance(SDNCAdapterCallbackRequest.class); + Marshaller m = context.createMarshaller(); + m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + m.marshal(this, writer); + return writer.getBuffer().toString(); + } catch (JAXBException e) { + return ""; + } + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java new file mode 100644 index 0000000000..179776d95d --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java @@ -0,0 +1,111 @@ +/*- + * ============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.onap.so.bpmn.common.adapter.sdnc; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element ref="{http://org.onap/workflow/sdnc/adapter/schema/v1}RequestHeader"/> + * <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "requestHeader", + "requestData" +}) +@XmlRootElement(name = "SDNCAdapterRequest") +public class SDNCAdapterRequest { + + @XmlElement(name = "RequestHeader", required = true) + protected RequestHeader requestHeader; + @XmlElement(name = "RequestData", required = true) + protected Object requestData; + + /** + * Gets the value of the requestHeader property. + * + * @return + * possible object is + * {@link RequestHeader } + * + */ + public RequestHeader getRequestHeader() { + return requestHeader; + } + + /** + * Sets the value of the requestHeader property. + * + * @param value + * allowed object is + * {@link RequestHeader } + * + */ + public void setRequestHeader(RequestHeader value) { + this.requestHeader = value; + } + + /** + * Gets the value of the requestData property. + * + * @return + * possible object is + * {@link Object } + * + */ + public Object getRequestData() { + return requestData; + } + + /** + * Sets the value of the requestData property. + * + * @param value + * allowed object is + * {@link Object } + * + */ + public void setRequestData(Object value) { + this.requestData = value; + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java new file mode 100644 index 0000000000..3666cb56a6 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java @@ -0,0 +1,51 @@ +/*- + * ============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.onap.so.bpmn.common.adapter.sdnc; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "SDNCAdapterResponse") +public class SDNCAdapterResponse { + + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java new file mode 100644 index 0000000000..eff70f5b12 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java @@ -0,0 +1,53 @@ +/*- + * ============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.onap.so.bpmn.common.adapter.sdnc; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.jws.soap.SOAPBinding; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.4-b01 + * Generated source version: 2.2 + * + */ +@WebService(name = "SDNCCallbackAdapterPortType", targetNamespace = "http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1") +@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) +public interface SDNCCallbackAdapterPortType { + + + /** + * + * @param sdncAdapterCallbackRequest + * @return + * returns org.openecomp.domain2.workflow.sdnc.adapter.schema.v1.SDNCAdapterResponse + */ + @WebMethod(operationName = "SDNCAdapterCallback") + @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") + public SDNCAdapterResponse sdncAdapterCallback( + @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest") + SDNCAdapterCallbackRequest sdncAdapterCallbackRequest); + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/package-info.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/package-info.java new file mode 100644 index 0000000000..ec341d82b5 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/package-info.java @@ -0,0 +1,22 @@ +/*- + * ============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========================================================= + */ + +@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package org.onap.so.bpmn.common.adapter.sdnc; diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/CreateVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/CreateVnfNotification.java new file mode 100644 index 0000000000..aa348c7765 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/CreateVnfNotification.java @@ -0,0 +1,462 @@ +/*- + * ============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.onap.so.bpmn.common.adapter.vnf; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for createVnfNotification complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="createVnfNotification"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> + * <element name="exception" type="{http://org.onap.so/vnfNotify}msoExceptionCategory" minOccurs="0"/> + * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="outputs" minOccurs="0"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="entry" maxOccurs="unbounded" minOccurs="0"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * <element name="rollback" type="{http://org.onap.so/vnfNotify}vnfRollback" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "createVnfNotification1", propOrder = { + "messageId", + "completed", + "exception", + "errorMessage", + "vnfId", + "outputs", + "rollback" +}) +public class CreateVnfNotification { + + @XmlElement(required = true) + protected String messageId; + protected boolean completed; + protected MsoExceptionCategory exception; + protected String errorMessage; + protected String vnfId; + protected Outputs outputs; + protected VnfRollback rollback; + + /** + * Gets the value of the messageId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageId() { + return messageId; + } + + /** + * Sets the value of the messageId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageId(String value) { + this.messageId = value; + } + + /** + * Gets the value of the completed property. + * + */ + public boolean isCompleted() { + return completed; + } + + /** + * Sets the value of the completed property. + * + */ + public void setCompleted(boolean value) { + this.completed = value; + } + + /** + * Gets the value of the exception property. + * + * @return + * possible object is + * {@link MsoExceptionCategory } + * + */ + public MsoExceptionCategory getException() { + return exception; + } + + /** + * Sets the value of the exception property. + * + * @param value + * allowed object is + * {@link MsoExceptionCategory } + * + */ + public void setException(MsoExceptionCategory value) { + this.exception = value; + } + + /** + * Gets the value of the errorMessage property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getErrorMessage() { + return errorMessage; + } + + /** + * Sets the value of the errorMessage property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setErrorMessage(String value) { + this.errorMessage = value; + } + + /** + * Gets the value of the vnfId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVnfId() { + return vnfId; + } + + /** + * Sets the value of the vnfId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVnfId(String value) { + this.vnfId = value; + } + + /** + * Gets the value of the outputs property. + * + * @return + * possible object is + * {@link CreateVnfNotification.Outputs } + * + */ + public CreateVnfNotification.Outputs getOutputs() { + return outputs; + } + + /** + * Sets the value of the outputs property. + * + * @param value + * allowed object is + * {@link CreateVnfNotification.Outputs } + * + */ + public void setOutputs(CreateVnfNotification.Outputs value) { + this.outputs = value; + } + + /** + * Gets the value of the rollback property. + * + * @return + * possible object is + * {@link VnfRollback } + * + */ + public VnfRollback getRollback() { + return rollback; + } + + /** + * Sets the value of the rollback property. + * + * @param value + * allowed object is + * {@link VnfRollback } + * + */ + public void setRollback(VnfRollback value) { + this.rollback = value; + } + + + /** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="entry" maxOccurs="unbounded" minOccurs="0"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "entry" + }) + public static class Outputs { + + protected List<CreateVnfNotification.Outputs.Entry> entry; + + /** + * Gets the value of the entry property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the entry property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getEntry().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link CreateVnfNotification.Outputs.Entry } + * + * + */ + public List<CreateVnfNotification.Outputs.Entry> getEntry() { + if (entry == null) { + entry = new ArrayList<>(); + } + return this.entry; + } + + // Not a generated method + @Override + public String toString() { + StringBuilder out = new StringBuilder(); + out.append("<outputs>\n"); + if (entry != null) { + for (Entry e : entry) { + out.append(e.toString()); + out.append('\n'); + } + } + out.append("</outputs>"); + return out.toString(); + } + + /** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "key", + "value" + }) + public static class Entry { + + protected String key; + protected String value; + + /** + * Gets the value of the key property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getKey() { + return key; + } + + /** + * Sets the value of the key property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setKey(String value) { + this.key = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + + } + + // Not a generated method + @Override + public String toString() { + String entrystr; + entrystr = + "<entry>"+ '\n' + + " <key>"+key+"</key>" + '\n' + + " <value>"+value+"</value>" + '\n' + + "</entry>"; + return entrystr; + } + + } + + } + + // Not a generated method + @Override + public String toString() { + String createVnfNotification; + if (exception==null) { + createVnfNotification = "<ns2:createVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' + + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + + " <messageId>"+messageId+"</messageId>" + '\n' + + " <completed>"+completed+"</completed>" + '\n' + + " <vnfId>"+vnfId+"</vnfId>" + '\n' + + (outputs == null ? "" : outputs.toString() + '\n') + + " <rollback>"+rollback+"</rollback>" + '\n' + + "</ns2:createVnfNotification>"; + } else { + createVnfNotification = "<ns2:createVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' + + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + + " <messageId>"+messageId+"</messageId>" + '\n' + + " <completed>"+completed+"</completed>" + '\n' + + (outputs == null ? "" : outputs.toString() + '\n') + + " <exception>"+exception+"</exception>" + '\n' + + " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' + + "</ns2:createVnfNotification>"; + } + return createVnfNotification; + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java new file mode 100644 index 0000000000..3ad217306d --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java @@ -0,0 +1,198 @@ +/*- + * ============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.onap.so.bpmn.common.adapter.vnf; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for deleteVnfNotification complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="deleteVnfNotification"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> + * <element name="exception" type="{http://org.onap.so/vnfNotify}msoExceptionCategory" minOccurs="0"/> + * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "deleteVnfNotification1", propOrder = { + "messageId", + "completed", + "exception", + "errorMessage" +}) +public class DeleteVnfNotification { + + @XmlElement(required = true) + protected String messageId; + protected boolean completed; + protected MsoExceptionCategory exception; + protected String errorMessage; + + /** + * Gets the value of the messageId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageId() { + return messageId; + } + + /** + * Sets the value of the messageId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageId(String value) { + this.messageId = value; + } + + /** + * Gets the value of the completed property. + * + */ + public boolean isCompleted() { + return completed; + } + + /** + * Sets the value of the completed property. + * + */ + public void setCompleted(boolean value) { + this.completed = value; + } + + /** + * Gets the value of the exception property. + * + * @return + * possible object is + * {@link MsoExceptionCategory } + * + */ + public MsoExceptionCategory getException() { + return exception; + } + + /** + * Sets the value of the exception property. + * + * @param value + * allowed object is + * {@link MsoExceptionCategory } + * + */ + public void setException(MsoExceptionCategory value) { + this.exception = value; + } + + /** + * Gets the value of the errorMessage property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getErrorMessage() { + return errorMessage; + } + + /** + * Sets the value of the errorMessage property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setErrorMessage(String value) { + this.errorMessage = value; + } + + /** + * Overrides toString() method + * @return String type (deleteVnfNotification) + */ + + @Override + public String toString() { + String deleteVnfNotification; + if (exception == null) { + deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' + + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + + " <messageId>"+messageId+"</messageId>" + '\n' + + " <completed>"+completed+"</completed>" + '\n' + + "</ns2:deleteVnfNotification>"; + } else { + deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' + + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + + " <messageId>"+messageId+"</messageId>" + '\n' + + " <completed>"+completed+"</completed>" + '\n' + + " <exception>"+exception+"</exception>" + '\n' + + " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' + + "</ns2:deleteVnfNotification>"; + } + return deleteVnfNotification; + } + +/* + public String toString() { + StringWriter writer = new StringWriter(); + try { + JAXBContext context = JAXBContext + .newInstance(DeleteVnfNotification.class); + Marshaller m = context.createMarshaller(); + m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + m.marshal(this, writer); + //System.out.println("toString() - " + writer.getBuffer().toString()); + return writer.getBuffer().toString(); + } catch (JAXBException e) { + //System.out.println("JAXBException - " + e.getStackTrace()); + return ""; + } + } +*/ + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoExceptionCategory.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoExceptionCategory.java new file mode 100644 index 0000000000..e4c95e82cd --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoExceptionCategory.java @@ -0,0 +1,61 @@ +/*- + * ============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.onap.so.bpmn.common.adapter.vnf; + +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for msoExceptionCategory. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * <p> + * <pre> + * <simpleType name="msoExceptionCategory"> + * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> + * <enumeration value="OPENSTACK"/> + * <enumeration value="IO"/> + * <enumeration value="INTERNAL"/> + * <enumeration value="USERDATA"/> + * </restriction> + * </simpleType> + * </pre> + * + */ +@XmlType(name = "msoExceptionCategory") +@XmlEnum +public enum MsoExceptionCategory { + + OPENSTACK, + IO, + INTERNAL, + USERDATA; + + public String value() { + return name(); + } + + public static MsoExceptionCategory fromValue(String v) { + return valueOf(v); + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoRequest.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoRequest.java new file mode 100644 index 0000000000..6830109097 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoRequest.java @@ -0,0 +1,112 @@ +/*- + * ============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.onap.so.bpmn.common.adapter.vnf; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for msoRequest complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="msoRequest"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="requestId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="serviceInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "msoRequest", propOrder = { + "requestId", + "serviceInstanceId" +}) +public class MsoRequest { + + protected String requestId; + protected String serviceInstanceId; + + /** + * Gets the value of the requestId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRequestId() { + return requestId; + } + + /** + * Sets the value of the requestId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRequestId(String value) { + this.requestId = value; + } + + /** + * Gets the value of the serviceInstanceId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceInstanceId() { + return serviceInstanceId; + } + + /** + * Sets the value of the serviceInstanceId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceInstanceId(String value) { + this.serviceInstanceId = value; + } + + @Override + public String toString() { + return "<requestId>" + requestId + "</requestId>" + '\n' + "<serviceInstanceId>" + serviceInstanceId + + "</serviceInstanceId>"; + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/ObjectFactory.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/ObjectFactory.java new file mode 100644 index 0000000000..21bd08fae7 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/ObjectFactory.java @@ -0,0 +1,208 @@ +/*- + * ============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.onap.so.bpmn.common.adapter.vnf; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the org.onap.so.adapters.vnf.async.client package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + private static final String VNF_NOTIFY = "http://org.onap.so/vnfNotify"; + private static final QName _RollbackVnfNotification_QNAME = new QName(VNF_NOTIFY, "rollbackVnfNotification"); + private static final QName _DeleteVnfNotification_QNAME = new QName(VNF_NOTIFY, "deleteVnfNotification"); + private static final QName _CreateVnfNotification_QNAME = new QName(VNF_NOTIFY, "createVnfNotification"); + private static final QName _UpdateVnfNotification_QNAME = new QName(VNF_NOTIFY, "updateVnfNotification"); + private static final QName _QueryVnfNotification_QNAME = new QName(VNF_NOTIFY, "queryVnfNotification"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.onap.so.adapters.vnf.async.client + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link UpdateVnfNotification } + * + */ + public UpdateVnfNotification createUpdateVnfNotification() { + return new UpdateVnfNotification(); + } + + /** + * Create an instance of {@link UpdateVnfNotification.Outputs } + * + */ + public UpdateVnfNotification.Outputs createUpdateVnfNotificationOutputs() { + return new UpdateVnfNotification.Outputs(); + } + + /** + * Create an instance of {@link QueryVnfNotification } + * + */ + public QueryVnfNotification createQueryVnfNotification() { + return new QueryVnfNotification(); + } + + /** + * Create an instance of {@link QueryVnfNotification.Outputs } + * + */ + public QueryVnfNotification.Outputs createQueryVnfNotificationOutputs() { + return new QueryVnfNotification.Outputs(); + } + + /** + * Create an instance of {@link CreateVnfNotification } + * + */ + public CreateVnfNotification createCreateVnfNotification() { + return new CreateVnfNotification(); + } + + /** + * Create an instance of {@link CreateVnfNotification.Outputs } + * + */ + public CreateVnfNotification.Outputs createCreateVnfNotificationOutputs() { + return new CreateVnfNotification.Outputs(); + } + + /** + * Create an instance of {@link DeleteVnfNotification } + * + */ + public DeleteVnfNotification createDeleteVnfNotification() { + return new DeleteVnfNotification(); + } + + /** + * Create an instance of {@link RollbackVnfNotification } + * + */ + public RollbackVnfNotification createRollbackVnfNotification() { + return new RollbackVnfNotification(); + } + + /** + * Create an instance of {@link MsoRequest } + * + */ + public MsoRequest createMsoRequest() { + return new MsoRequest(); + } + + /** + * Create an instance of {@link VnfRollback } + * + */ + public VnfRollback createVnfRollback() { + return new VnfRollback(); + } + + /** + * Create an instance of {@link UpdateVnfNotification.Outputs.Entry } + * + */ + public UpdateVnfNotification.Outputs.Entry createUpdateVnfNotificationOutputsEntry() { + return new UpdateVnfNotification.Outputs.Entry(); + } + + /** + * Create an instance of {@link QueryVnfNotification.Outputs.Entry } + * + */ + public QueryVnfNotification.Outputs.Entry createQueryVnfNotificationOutputsEntry() { + return new QueryVnfNotification.Outputs.Entry(); + } + + /** + * Create an instance of {@link CreateVnfNotification.Outputs.Entry } + * + */ + public CreateVnfNotification.Outputs.Entry createCreateVnfNotificationOutputsEntry() { + return new CreateVnfNotification.Outputs.Entry(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link RollbackVnfNotification }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://org.onap.so/vnfNotify", name = "rollbackVnfNotification") + public JAXBElement<RollbackVnfNotification> createRollbackVnfNotification(RollbackVnfNotification value) { + return new JAXBElement<>(_RollbackVnfNotification_QNAME, RollbackVnfNotification.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link DeleteVnfNotification }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://org.onap.so/vnfNotify", name = "deleteVnfNotification") + public JAXBElement<DeleteVnfNotification> createDeleteVnfNotification(DeleteVnfNotification value) { + return new JAXBElement<>(_DeleteVnfNotification_QNAME, DeleteVnfNotification.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CreateVnfNotification }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://org.onap.so/vnfNotify", name = "createVnfNotification") + public JAXBElement<CreateVnfNotification> createCreateVnfNotification(CreateVnfNotification value) { + return new JAXBElement<>(_CreateVnfNotification_QNAME, CreateVnfNotification.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link UpdateVnfNotification }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://org.onap.so/vnfNotify", name = "updateVnfNotification") + public JAXBElement<UpdateVnfNotification> createUpdateVnfNotification(UpdateVnfNotification value) { + return new JAXBElement<>(_UpdateVnfNotification_QNAME, UpdateVnfNotification.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link QueryVnfNotification }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://org.onap.so/vnfNotify", name = "queryVnfNotification") + public JAXBElement<QueryVnfNotification> createQueryVnfNotification(QueryVnfNotification value) { + return new JAXBElement<>(_QueryVnfNotification_QNAME, QueryVnfNotification.class, null, value); + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/QueryVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/QueryVnfNotification.java new file mode 100644 index 0000000000..e7496b8028 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/QueryVnfNotification.java @@ -0,0 +1,488 @@ +/*- + * ============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.onap.so.bpmn.common.adapter.vnf; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for queryVnfNotification complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="queryVnfNotification"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> + * <element name="exception" type="{http://org.onap.so/vnfNotify}msoExceptionCategory" minOccurs="0"/> + * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="vnfExists" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> + * <element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="status" type="{http://org.onap.so/vnfNotify}vnfStatus" minOccurs="0"/> + * <element name="outputs" minOccurs="0"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="entry" maxOccurs="unbounded" minOccurs="0"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "queryVnfNotification1", propOrder = { + "messageId", + "completed", + "exception", + "errorMessage", + "vnfExists", + "vnfId", + "status", + "outputs" +}) +public class QueryVnfNotification { + + @XmlElement(required = true) + protected String messageId; + protected boolean completed; + protected MsoExceptionCategory exception; + protected String errorMessage; + protected Boolean vnfExists; + protected String vnfId; + protected VnfStatus status; + protected QueryVnfNotification.Outputs outputs; + + /** + * Gets the value of the messageId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageId() { + return messageId; + } + + /** + * Sets the value of the messageId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageId(String value) { + this.messageId = value; + } + + /** + * Gets the value of the completed property. + * + */ + public boolean isCompleted() { + return completed; + } + + /** + * Sets the value of the completed property. + * + */ + public void setCompleted(boolean value) { + this.completed = value; + } + + /** + * Gets the value of the exception property. + * + * @return + * possible object is + * {@link MsoExceptionCategory } + * + */ + public MsoExceptionCategory getException() { + return exception; + } + + /** + * Sets the value of the exception property. + * + * @param value + * allowed object is + * {@link MsoExceptionCategory } + * + */ + public void setException(MsoExceptionCategory value) { + this.exception = value; + } + + /** + * Gets the value of the errorMessage property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getErrorMessage() { + return errorMessage; + } + + /** + * Sets the value of the errorMessage property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setErrorMessage(String value) { + this.errorMessage = value; + } + + /** + * Gets the value of the vnfExists property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isVnfExists() { + return vnfExists; + } + + /** + * Sets the value of the vnfExists property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setVnfExists(Boolean value) { + this.vnfExists = value; + } + + /** + * Gets the value of the vnfId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVnfId() { + return vnfId; + } + + /** + * Sets the value of the vnfId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVnfId(String value) { + this.vnfId = value; + } + + /** + * Gets the value of the status property. + * + * @return + * possible object is + * {@link VnfStatus } + * + */ + public VnfStatus getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link VnfStatus } + * + */ + public void setStatus(VnfStatus value) { + this.status = value; + } + + /** + * Gets the value of the outputs property. + * + * @return + * possible object is + * {@link QueryVnfNotification.Outputs } + * + */ + public QueryVnfNotification.Outputs getOutputs() { + return outputs; + } + + /** + * Sets the value of the outputs property. + * + * @param value + * allowed object is + * {@link QueryVnfNotification.Outputs } + * + */ + public void setOutputs(QueryVnfNotification.Outputs value) { + this.outputs = value; + } + + + /** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="entry" maxOccurs="unbounded" minOccurs="0"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "entry" + }) + public static class Outputs { + + protected List<QueryVnfNotification.Outputs.Entry> entry; + + /** + * Gets the value of the entry property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the entry property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getEntry().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link QueryVnfNotification.Outputs.Entry } + * + * + */ + public List<QueryVnfNotification.Outputs.Entry> getEntry() { + if (entry == null) { + entry = new ArrayList<>(); + } + return this.entry; + } + + // Not a generated method + public String toString() { + StringBuilder out = new StringBuilder(); + out.append("<outputs>\n"); + if (entry != null) { + for (Entry e : entry) { + out.append(e.toString()); + out.append('\n'); + } + } + out.append("</outputs>"); + return out.toString(); + } + + + /** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "key", + "value" + }) + public static class Entry { + + protected String key; + protected String value; + + /** + * Gets the value of the key property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getKey() { + return key; + } + + /** + * Sets the value of the key property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setKey(String value) { + this.key = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + + // Not a generated method + public String toString() { + String entry = ""; + entry = + "<entry>"+ '\n' + + " <key>"+key+"</key>" + '\n' + + " <value>"+value+"</value>" + '\n' + + "</entry>"; + return entry; + } + + } + + } + + // Not a generated method + public String toString() { + String queryVnfNotification = ""; + if (exception==null) { + queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' + + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + + " <messageId>"+messageId+"</messageId>" + '\n' + + " <completed>"+completed+"</completed>" + '\n' + + " <vnfExists>"+vnfExists+"</vnfExists>" + '\n' + + " <vnfId>"+vnfId+"</vnfId>" + '\n' + + " <status>"+status+"</status>" + '\n' + + (outputs == null ? "" : outputs.toString() + '\n') + + "</ns2:queryVnfNotification>"; + } else { + queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' + + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + + " <messageId>"+messageId+"</messageId>" + '\n' + + " <completed>"+completed+"</completed>" + '\n' + + (outputs == null ? "" : outputs.toString() + '\n') + + " <exception>"+exception+"</exception>" + '\n' + + " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' + + "</ns2:queryVnfNotification>"; + } + return queryVnfNotification; + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/RollbackVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/RollbackVnfNotification.java new file mode 100644 index 0000000000..6b143a2494 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/RollbackVnfNotification.java @@ -0,0 +1,175 @@ +/*- + * ============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.onap.so.bpmn.common.adapter.vnf; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for rollbackVnfNotification complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="rollbackVnfNotification"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> + * <element name="exception" type="{http://org.onap.so/vnfNotify}msoExceptionCategory" minOccurs="0"/> + * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "rollbackVnfNotification1", propOrder = { + "messageId", + "completed", + "exception", + "errorMessage" +}) +public class RollbackVnfNotification { + + @XmlElement(required = true) + protected String messageId; + protected boolean completed; + protected MsoExceptionCategory exception; + protected String errorMessage; + + /** + * Gets the value of the messageId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageId() { + return messageId; + } + + /** + * Sets the value of the messageId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageId(String value) { + this.messageId = value; + } + + /** + * Gets the value of the completed property. + * + */ + public boolean isCompleted() { + return completed; + } + + /** + * Sets the value of the completed property. + * + */ + public void setCompleted(boolean value) { + this.completed = value; + } + + /** + * Gets the value of the exception property. + * + * @return + * possible object is + * {@link MsoExceptionCategory } + * + */ + public MsoExceptionCategory getException() { + return exception; + } + + /** + * Sets the value of the exception property. + * + * @param value + * allowed object is + * {@link MsoExceptionCategory } + * + */ + public void setException(MsoExceptionCategory value) { + this.exception = value; + } + + /** + * Gets the value of the errorMessage property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getErrorMessage() { + return errorMessage; + } + + /** + * Sets the value of the errorMessage property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setErrorMessage(String value) { + this.errorMessage = value; + } + + public String toString() { + String rollbackVnfNotification = ""; + if (exception==null) { + rollbackVnfNotification = "<ns2:rollbackVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' + + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + + " <messageId>"+messageId+"</messageId>" + '\n' + + " <completed>"+completed+"</completed>" + '\n' + + "</ns2:rollbackVnfNotification>"; + } else { + rollbackVnfNotification = "<ns2:rollbackVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' + + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + + " <messageId>"+messageId+"</messageId>" + '\n' + + " <completed>"+completed+"</completed>" + '\n' + + " <exception>"+exception+"</exception>" + '\n' + + " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' + + "</ns2:rollbackVnfNotification>"; + } + return rollbackVnfNotification; + + } + + } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/UpdateVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/UpdateVnfNotification.java new file mode 100644 index 0000000000..b89135b865 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/UpdateVnfNotification.java @@ -0,0 +1,412 @@ +/*- + * ============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.onap.so.bpmn.common.adapter.vnf; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for updateVnfNotification complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="updateVnfNotification"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> + * <element name="exception" type="{http://org.onap.so/vnfNotify}msoExceptionCategory" minOccurs="0"/> + * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="outputs" minOccurs="0"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="entry" maxOccurs="unbounded" minOccurs="0"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * <element name="rollback" type="{http://org.onap.so/vnfNotify}vnfRollback" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "updateVnfNotification1", propOrder = { + "messageId", + "completed", + "exception", + "errorMessage", + "outputs", + "rollback" +}) +public class UpdateVnfNotification { + + @XmlElement(required = true) + protected String messageId; + protected boolean completed; + protected MsoExceptionCategory exception; + protected String errorMessage; + protected UpdateVnfNotification.Outputs outputs; + protected VnfRollback rollback; + + /** + * Gets the value of the messageId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageId() { + return messageId; + } + + /** + * Sets the value of the messageId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageId(String value) { + this.messageId = value; + } + + /** + * Gets the value of the completed property. + * + */ + public boolean isCompleted() { + return completed; + } + + /** + * Sets the value of the completed property. + * + */ + public void setCompleted(boolean value) { + this.completed = value; + } + + /** + * Gets the value of the exception property. + * + * @return + * possible object is + * {@link MsoExceptionCategory } + * + */ + public MsoExceptionCategory getException() { + return exception; + } + + /** + * Sets the value of the exception property. + * + * @param value + * allowed object is + * {@link MsoExceptionCategory } + * + */ + public void setException(MsoExceptionCategory value) { + this.exception = value; + } + + /** + * Gets the value of the errorMessage property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getErrorMessage() { + return errorMessage; + } + + /** + * Sets the value of the errorMessage property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setErrorMessage(String value) { + this.errorMessage = value; + } + + /** + * Gets the value of the outputs property. + * + * @return + * possible object is + * {@link UpdateVnfNotification.Outputs } + * + */ + public UpdateVnfNotification.Outputs getOutputs() { + return outputs; + } + + /** + * Sets the value of the outputs property. + * + * @param value + * allowed object is + * {@link UpdateVnfNotification.Outputs } + * + */ + public void setOutputs(UpdateVnfNotification.Outputs value) { + this.outputs = value; + } + + /** + * Gets the value of the rollback property. + * + * @return + * possible object is + * {@link VnfRollback } + * + */ + public VnfRollback getRollback() { + return rollback; + } + + /** + * Sets the value of the rollback property. + * + * @param value + * allowed object is + * {@link VnfRollback } + * + */ + public void setRollback(VnfRollback value) { + this.rollback = value; + } + + + /** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="entry" maxOccurs="unbounded" minOccurs="0"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "entry" + }) + public static class Outputs { + + protected List<UpdateVnfNotification.Outputs.Entry> entry; + + /** + * Gets the value of the entry property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the entry property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getEntry().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link UpdateVnfNotification.Outputs.Entry } + * + * + */ + public List<UpdateVnfNotification.Outputs.Entry> getEntry() { + if (entry == null) { + entry = new ArrayList<>(); + } + return this.entry; + } + + + /** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "key", + "value" + }) + public static class Entry { + + protected String key; + protected String value; + + /** + * Gets the value of the key property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getKey() { + return key; + } + + /** + * Sets the value of the key property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setKey(String value) { + this.key = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + + public String toString() { + String entry = ""; + entry = + " <key>"+key+"</key>" + '\n' + + " <value>"+value+"</value>"; + return entry; + } + } + + } + + public String toString(){ + String updateVnfNotification = ""; + if (exception==null) { + updateVnfNotification = "<ns2:updateVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' + + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + + " <messageId>"+messageId+"</messageId>" + '\n' + + " <completed>"+completed+"</completed>" + '\n' + + " <rollback>"+rollback+"</rollback>" + '\n' + + "</ns2:updateVnfNotification>"; + } else { + updateVnfNotification = "<ns2:updateVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' + + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + + " <messageId>"+messageId+"</messageId>" + '\n' + + " <completed>"+completed+"</completed>" + '\n' + + " <exception>"+exception+"</exception>" + '\n' + + " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' + + "</ns2:updateVnfNotification>"; + } + + return updateVnfNotification; + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify.java new file mode 100644 index 0000000000..adedca9ac5 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify.java @@ -0,0 +1,177 @@ +/*- + * ============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.onap.so.bpmn.common.adapter.vnf; + +import javax.jws.Oneway; +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.Action; +import javax.xml.ws.RequestWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.8 + * Generated source version: 2.2 + * + */ +@WebService(name = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface VnfAdapterNotify { + + + /** + * + * @param errorMessage + * @param exception + * @param messageId + * @param completed + */ + @WebMethod + @Oneway + @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.RollbackVnfNotification") + @Action(input = "http://org.onap.so/notify/adapterNotify/rollbackVnfNotificationRequest") + public void rollbackVnfNotification( + @WebParam(name = "messageId", targetNamespace = "") + String messageId, + @WebParam(name = "completed", targetNamespace = "") + boolean completed, + @WebParam(name = "exception", targetNamespace = "") + MsoExceptionCategory exception, + @WebParam(name = "errorMessage", targetNamespace = "") + String errorMessage); + + /** + * + * @param errorMessage + * @param vnfExists + * @param status + * @param exception + * @param outputs + * @param messageId + * @param vnfId + * @param completed + */ + @WebMethod + @Oneway + @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.QueryVnfNotification") + @Action(input = "http://org.onap.so/notify/adapterNotify/queryVnfNotificationRequest") + public void queryVnfNotification( + @WebParam(name = "messageId", targetNamespace = "") + String messageId, + @WebParam(name = "completed", targetNamespace = "") + boolean completed, + @WebParam(name = "exception", targetNamespace = "") + MsoExceptionCategory exception, + @WebParam(name = "errorMessage", targetNamespace = "") + String errorMessage, + @WebParam(name = "vnfExists", targetNamespace = "") + Boolean vnfExists, + @WebParam(name = "vnfId", targetNamespace = "") + String vnfId, + @WebParam(name = "status", targetNamespace = "") + VnfStatus status, + @WebParam(name = "outputs", targetNamespace = "") + org.onap.so.bpmn.common.adapter.vnf.QueryVnfNotification.Outputs outputs); + + /** + * + * @param errorMessage + * @param exception + * @param rollback + * @param outputs + * @param messageId + * @param vnfId + * @param completed + */ + @WebMethod + @Oneway + @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.CreateVnfNotification") + @Action(input = "http://org.onap.so/notify/adapterNotify/createVnfNotificationRequest") + public void createVnfNotification( + @WebParam(name = "messageId", targetNamespace = "") + String messageId, + @WebParam(name = "completed", targetNamespace = "") + boolean completed, + @WebParam(name = "exception", targetNamespace = "") + MsoExceptionCategory exception, + @WebParam(name = "errorMessage", targetNamespace = "") + String errorMessage, + @WebParam(name = "vnfId", targetNamespace = "") + String vnfId, + @WebParam(name = "outputs", targetNamespace = "") + org.onap.so.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs outputs, + @WebParam(name = "rollback", targetNamespace = "") + VnfRollback rollback); + + /** + * + * @param errorMessage + * @param exception + * @param rollback + * @param outputs + * @param messageId + * @param completed + */ + @WebMethod + @Oneway + @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.UpdateVnfNotification") + @Action(input = "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest") + public void updateVnfNotification( + @WebParam(name = "messageId", targetNamespace = "") + String messageId, + @WebParam(name = "completed", targetNamespace = "") + boolean completed, + @WebParam(name = "exception", targetNamespace = "") + MsoExceptionCategory exception, + @WebParam(name = "errorMessage", targetNamespace = "") + String errorMessage, + @WebParam(name = "outputs", targetNamespace = "") + org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs outputs, + @WebParam(name = "rollback", targetNamespace = "") + VnfRollback rollback); + + /** + * + * @param errorMessage + * @param exception + * @param messageId + * @param completed + */ + @WebMethod + @Oneway + @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.DeleteVnfNotification") + @Action(input = "http://org.onap.so/notify/adapterNotify/deleteVnfNotificationRequest") + public void deleteVnfNotification( + @WebParam(name = "messageId", targetNamespace = "") + String messageId, + @WebParam(name = "completed", targetNamespace = "") + boolean completed, + @WebParam(name = "exception", targetNamespace = "") + MsoExceptionCategory exception, + @WebParam(name = "errorMessage", targetNamespace = "") + String errorMessage); + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java new file mode 100644 index 0000000000..667545d855 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java @@ -0,0 +1,108 @@ +/*- + * ============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.onap.so.bpmn.common.adapter.vnf; + +import java.net.URL; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.WebServiceFeature; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.8 + * Generated source version: 2.2 + * + */ +@WebServiceClient(name = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify", wsdlLocation = "/VnfAdapterNotify.wsdl") +public class VnfAdapterNotify_Service extends Service +{ + + private final static URL VNFADAPTERNOTIFY_WSDL_LOCATION; + private final static WebServiceException VNFADAPTERNOTIFY_EXCEPTION; + private final static QName VNFADAPTERNOTIFY_QNAME = new QName("http://org.onap.so/vnfNotify", "vnfAdapterNotify"); + + static { + VNFADAPTERNOTIFY_WSDL_LOCATION = org.onap.so.bpmn.common.adapter.vnf.VnfAdapterNotify_Service.class.getResource("/VnfAdapterNotify.wsdl"); + WebServiceException e = null; + if (VNFADAPTERNOTIFY_WSDL_LOCATION == null) { + e = new WebServiceException("Cannot find '/VnfAdapterNotify.wsdl' wsdl. Place the resource correctly in the classpath."); + } + VNFADAPTERNOTIFY_EXCEPTION = e; + } + + public VnfAdapterNotify_Service() { + super(__getWsdlLocation(), VNFADAPTERNOTIFY_QNAME); + } + + public VnfAdapterNotify_Service(WebServiceFeature... features) { + super(__getWsdlLocation(), VNFADAPTERNOTIFY_QNAME, features); + } + + public VnfAdapterNotify_Service(URL wsdlLocation) { + super(wsdlLocation, VNFADAPTERNOTIFY_QNAME); + } + + public VnfAdapterNotify_Service(URL wsdlLocation, WebServiceFeature... features) { + super(wsdlLocation, VNFADAPTERNOTIFY_QNAME, features); + } + + public VnfAdapterNotify_Service(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public VnfAdapterNotify_Service(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return + * returns VnfAdapterNotify + */ + @WebEndpoint(name = "MsoVnfAdapterAsyncImplPort") + public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort() { + return super.getPort(new QName("http://org.onap.so/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. + * @return + * returns VnfAdapterNotify + */ + @WebEndpoint(name = "MsoVnfAdapterAsyncImplPort") + public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort(WebServiceFeature... features) { + return super.getPort(new QName("http://org.onap.so/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class, features); + } + + private static URL __getWsdlLocation() { + if (VNFADAPTERNOTIFY_EXCEPTION!= null) { + throw VNFADAPTERNOTIFY_EXCEPTION; + } + return VNFADAPTERNOTIFY_WSDL_LOCATION; + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java new file mode 100644 index 0000000000..194ce58fe9 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java @@ -0,0 +1,210 @@ +/*- + * ============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.onap.so.bpmn.common.adapter.vnf; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for vnfRollback complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="vnfRollback"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="cloudSiteId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="msoRequest" type="{http://org.onap.so/vnfNotify}msoRequest" minOccurs="0"/> + * <element name="tenantCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/> + * <element name="tenantId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="vnfCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/> + * <element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "vnfRollback", propOrder = { + "cloudSiteId", + "msoRequest", + "tenantCreated", + "tenantId", + "vnfCreated", + "vnfId" +}) +public class VnfRollback { + + protected String cloudSiteId; + protected MsoRequest msoRequest; + protected boolean tenantCreated; + protected String tenantId; + protected boolean vnfCreated; + protected String vnfId; + + /** + * Gets the value of the cloudSiteId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCloudSiteId() { + return cloudSiteId; + } + + /** + * Sets the value of the cloudSiteId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCloudSiteId(String value) { + this.cloudSiteId = value; + } + + /** + * Gets the value of the msoRequest property. + * + * @return + * possible object is + * {@link MsoRequest } + * + */ + public MsoRequest getMsoRequest() { + return msoRequest; + } + + /** + * Sets the value of the msoRequest property. + * + * @param value + * allowed object is + * {@link MsoRequest } + * + */ + public void setMsoRequest(MsoRequest value) { + this.msoRequest = value; + } + + /** + * Gets the value of the tenantCreated property. + * + */ + public boolean isTenantCreated() { + return tenantCreated; + } + + /** + * Sets the value of the tenantCreated property. + * + */ + public void setTenantCreated(boolean value) { + this.tenantCreated = value; + } + + /** + * Gets the value of the tenantId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTenantId() { + return tenantId; + } + + /** + * Sets the value of the tenantId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTenantId(String value) { + this.tenantId = value; + } + + /** + * Gets the value of the vnfCreated property. + * + */ + public boolean isVnfCreated() { + return vnfCreated; + } + + /** + * Sets the value of the vnfCreated property. + * + */ + public void setVnfCreated(boolean value) { + this.vnfCreated = value; + } + + /** + * Gets the value of the vnfId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVnfId() { + return vnfId; + } + + /** + * Sets the value of the vnfId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVnfId(String value) { + this.vnfId = value; + } + + public String toString() { + String msoRequestElement = msoRequest == null ? "" + : "<msoRequest>"+msoRequest+"</msoRequest>" + '\n'; + + return + "<cloudSiteId>"+cloudSiteId+"</cloudSiteId>" + '\n' + + msoRequestElement + + "<tenantCreated>"+tenantCreated+"</tenantCreated>" + '\n' + + "<tenantId>"+tenantId+"</tenantId>" + '\n' + + "<vnfCreated>"+vnfCreated+"</vnfCreated>" + '\n' + + "<vnfId>"+vnfId+"</vnfId>"; + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfStatus.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfStatus.java new file mode 100644 index 0000000000..d093f79e03 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfStatus.java @@ -0,0 +1,61 @@ +/*- + * ============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.onap.so.bpmn.common.adapter.vnf; + +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for vnfStatus. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * <p> + * <pre> + * <simpleType name="vnfStatus"> + * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> + * <enumeration value="ACTIVE"/> + * <enumeration value="FAILED"/> + * <enumeration value="NOTFOUND"/> + * <enumeration value="UNKNOWN"/> + * </restriction> + * </simpleType> + * </pre> + * + */ +@XmlType(name = "vnfStatus") +@XmlEnum +public enum VnfStatus { + + ACTIVE, + FAILED, + NOTFOUND, + UNKNOWN; + + public String value() { + return name(); + } + + public static VnfStatus fromValue(String v) { + return valueOf(v); + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/package-info.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/package-info.java new file mode 100644 index 0000000000..654673ad4a --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/package-info.java @@ -0,0 +1,22 @@ +/*- + * ============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========================================================= + */ + +@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.onap.so/vnfNotify") +package org.onap.so.bpmn.common.adapter.vnf; diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java new file mode 100644 index 0000000000..f274850b8d --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java @@ -0,0 +1,425 @@ +/*- + * ============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.onap.so.bpmn.common.workflow.service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.camunda.bpm.engine.MismatchingMessageCorrelationException; +import org.camunda.bpm.engine.OptimisticLockingException; +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.runtime.Execution; +import org.camunda.bpm.engine.runtime.MessageCorrelationResult; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +/** + * Abstract base class for callback services. + */ +@Service +public class CallbackHandlerService { + public static final long DEFAULT_TIMEOUT_SECONDS = 60; + public static final long FAST_POLL_DUR_SECONDS = 5; + public static final long FAST_POLL_INT_MS = 100; + public static final long SLOW_POLL_INT_MS = 1000; + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CallbackHandlerService.class); + + @Autowired + RuntimeService runtimeService; + + /** + * Parameterized callback handler. + */ + @Async + protected CallbackResult handleCallback(String method, Object message, + String messageEventName, String messageVariable, + String correlationVariable, String correlationValue, + String logMarker) { + + return handleCallback(method, message, messageEventName, messageVariable, + correlationVariable, correlationValue, logMarker, null); + } + + /** + * Parameterized callback handler. + */ + protected CallbackResult handleCallback(String method, Object message, + String messageEventName, String messageVariable, + String correlationVariable, String correlationValue, + String logMarker, Map<String, Object> injectedVariables) { + + long startTime = System.currentTimeMillis(); + + LOGGER.debug(logMarker + " " + method + " received message: " + + (message == null ? "" : System.lineSeparator()) + message); + + try { + Map<String, Object> variables = new HashMap<>(); + + if (injectedVariables != null) { + variables.putAll(injectedVariables); + } + + variables.put(correlationVariable, correlationValue); + variables.put(messageVariable, message == null ? null : message.toString()); + + boolean ok = correlate(messageEventName, correlationVariable, + correlationValue, variables, logMarker); + + if (!ok) { + String msg = "No process is waiting for " + messageEventName + + " with " + correlationVariable + " = '" + correlationValue + "'"; + logCallbackError(method, startTime, msg); + return new CallbackError(msg); + } + + logCallbackSuccess(method, startTime); + return new CallbackSuccess(); + } catch (Exception e) { + LOGGER.debug("Exception :",e); + String msg = "Caught " + e.getClass().getSimpleName() + + " processing " + messageEventName + " with " + correlationVariable + + " = '" + correlationValue + "'"; + logCallbackError(method, startTime, msg); + return new CallbackError(msg); + } + } + + /** + * Performs message correlation. Waits a limited amount of time for + * a process to become ready for correlation. The return value indicates + * whether or not a process was found to receive the message. Due to the + * synchronous nature of message injection in Camunda, by the time this + * method returns, one of 3 things will have happened: (1) the process + * received the message and ended, (2) the process received the message + * and reached an activity that suspended, or (3) an exception occurred + * during correlation or while the process was executing. Correlation + * exceptions are handled differently from process execution exceptions. + * Correlation exceptions are thrown so the client knows something went + * wrong with the delivery of the message. Process execution exceptions + * are logged but not thrown. + * @param messageEventName the message event name + * @param correlationVariable the process variable used as the correlator + * @param correlationValue the correlation value + * @param variables variables to inject into the process + * @param logMarker a marker for debug logging + * @return true if a process could be found, false if not + * @throws Exception for correlation errors + */ + protected boolean correlate(String messageEventName, String correlationVariable, + String correlationValue, Map<String, Object> variables, String logMarker) + throws Exception { + try{ + LOGGER.debug(logMarker + " Attempting to find process waiting" + + " for " + messageEventName + " with " + correlationVariable + + " = '" + correlationValue + "'"); + + + + long timeout = DEFAULT_TIMEOUT_SECONDS; + + // The code is here in case we ever need to change the default. + String correlationTimemout = UrnPropertiesReader.getVariable("mso.correlation.timeout"); + if (correlationTimemout != null) { + try { + timeout = Long.parseLong(correlationTimemout); + } catch (NumberFormatException e) { + // Ignore + } + } + + long now = System.currentTimeMillis(); + long fastPollEndTime = now + (FAST_POLL_DUR_SECONDS * 1000); + long endTime = now + (timeout * 1000); + long sleep = FAST_POLL_INT_MS; + + List<Execution> waitingProcesses = null; + Exception queryException = null; + int queryCount = 0; + int queryFailCount = 0; + + while (true) { + try { + ++queryCount; + waitingProcesses = runtimeService.createExecutionQuery() + .messageEventSubscriptionName(messageEventName) + .processVariableValueEquals(correlationVariable, correlationValue) + .list(); + } catch (Exception e) { + ++queryFailCount; + queryException = e; + } + + if (waitingProcesses != null && waitingProcesses.size() > 0) { + break; + } + + if (now > endTime - sleep) { + break; + } + + Thread.sleep(sleep); + now = System.currentTimeMillis(); + + if (now > fastPollEndTime) { + sleep = SLOW_POLL_INT_MS; + } + } + + if (waitingProcesses == null) { + waitingProcesses = new ArrayList<Execution>(0); + } + + int count = waitingProcesses.size(); + + List<ExecInfo> execInfoList = new ArrayList<>(count); + for (Execution execution : waitingProcesses) { + execInfoList.add(new ExecInfo(execution)); + } + + LOGGER.debug(logMarker + " Found " + count + " process(es) waiting" + + " for " + messageEventName + " with " + correlationVariable + + " = '" + correlationValue + "': " + execInfoList); + + if (count == 0) { + if (queryFailCount > 0) { + String msg = queryFailCount + "/" + queryCount + + " execution queries failed attempting to correlate " + + messageEventName + " with " + correlationVariable + + " = '" + correlationValue + "'; last exception was:" + + queryException; + LOGGER.debug(msg); + LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, msg, queryException); + } + + return false; + } + + if (count > 1) { + // Only one process should be waiting. Throw an exception back to the client. + throw new MismatchingMessageCorrelationException(messageEventName, + "more than 1 process is waiting with " + correlationVariable + + " = '" + correlationValue + "'"); + } + + // We prototyped an asynchronous solution, i.e. resuming the process + // flow in a separate thread, but this affected too many existing tests, + // and we went back to the synchronous solution. The synchronous solution + // has some troublesome characteristics though. For example, the + // resumed flow may send request #2 to a remote system before MSO has + // acknowledged the notification associated with request #1. + + try { + LOGGER.debug(logMarker + " Running " + execInfoList.get(0) + " to receive " + + messageEventName + " with " + correlationVariable + " = '" + + correlationValue + "'"); + + @SuppressWarnings("unused") + MessageCorrelationResult result = runtimeService + .createMessageCorrelation(messageEventName) + .setVariables(variables) + .processInstanceVariableEquals(correlationVariable, correlationValue) + .correlateWithResult(); + + } catch (MismatchingMessageCorrelationException e) { + // A correlation exception occurred even after we identified + // one waiting process. Throw it back to the client. + throw e; + } catch (OptimisticLockingException ole) { + + String msg = "Caught " + ole.getClass().getSimpleName() + " after receiving " + messageEventName + + " with " + correlationVariable + " = '" + correlationValue + + "': " + ole; + LOGGER.debug(msg); + LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN CORRELATION ERROR -", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, msg, ole); + + //Retry for OptimisticLocking Exceptions + int retryCount = 0; + String retryStr = UrnPropertiesReader.getVariable("mso.bpmn.optimisticlockingexception.retrycount"); + if (retryStr != null) { + try { + retryCount = Integer.parseInt(retryStr); + } catch (NumberFormatException e) { + // Ignore + } + } + + LOGGER.debug("Retry correlate for OptimisticLockingException, retryCount:" + retryCount); + + for (; retryCount >0 ; retryCount--) { + + try{ + Thread.sleep(SLOW_POLL_INT_MS); + + @SuppressWarnings("unused") + MessageCorrelationResult result = runtimeService + .createMessageCorrelation(messageEventName) + .setVariables(variables) + .processInstanceVariableEquals(correlationVariable, correlationValue) + .correlateWithResult(); + retryCount = 0; + LOGGER.debug("OptimisticLockingException retry was successful, seting retryCount: " + retryCount); + } catch (OptimisticLockingException olex) { + //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException; + String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + olex; + LOGGER.debug(strMsg); + LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, strMsg, olex); + } catch (Exception excep) { + retryCount = 0; + //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException; + String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + excep; + LOGGER.debug(strMsg); + LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, strMsg, excep); + } + + } + + }catch (Exception e) { + // This must be an exception from the flow itself. Log it, but don't + // report it back to the client. + String msg = "Caught " + e.getClass().getSimpleName() + " running " + + execInfoList.get(0) + " after receiving " + messageEventName + + " with " + correlationVariable + " = '" + correlationValue + + "': " + e; + LOGGER.debug(msg); + LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, msg, e); + } + } catch (Exception e) { + // This must be an exception from the flow itself. Log it, but don't + // report it back to the client. + String msg = "Caught " + e.getClass().getSimpleName() + " after receiving " + messageEventName + + " with " + correlationVariable + " = '" + correlationValue + + "': " + e; + LOGGER.debug(msg); + LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN CORRELATION ERROR -", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, msg, e); + } + + return true; + } + + /** + * Records audit and metric events in the log for a callback success. + * @param method the method name + * @param startTime the request start time + */ + protected void logCallbackSuccess(String method, long startTime) { + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, + MsoLogger.ResponseCode.Suc, "Completed " + method); + + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, + MsoLogger.ResponseCode.Suc, "Completed " + method, + "BPMN", MsoLogger.getServiceName(), null); + } + + /** + * Records error, audit and metric events in the log for a callback + * internal error. + * @param method the method name + * @param startTime the request start time + * @param msg the error message + */ + protected void logCallbackError(String method, long startTime, String msg) { + logCallbackError(method, startTime, msg, null); + } + + /** + * Records error, audit and metric events in the log for a callback + * internal error. + * @param method the method name + * @param startTime the request start time + * @param msg the error message + * @param e the exception + */ + protected void logCallbackError(String method, long startTime, String msg, Exception e) { + if (e == null) { + LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, msg); + } else { + LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, msg, e); + } + + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, + MsoLogger.ResponseCode.InternalError, "Completed " + method); + + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, + MsoLogger.ResponseCode.InternalError, "Completed " + method, + "BPMN", MsoLogger.getServiceName(), null); + } + + /** + * Abstract callback result object. + */ + protected abstract class CallbackResult { + } + + /** + * Indicates that callback handling was successful. + */ + protected class CallbackSuccess extends CallbackResult { + } + + /** + * Indicates that callback handling failed. + */ + protected class CallbackError extends CallbackResult { + private final String errorMessage; + + public CallbackError(String errorMessage) { + this.errorMessage = errorMessage; + } + + /** + * Gets the error message. + */ + public String getErrorMessage() { + return errorMessage; + } + } + + private static class ExecInfo { + private final Execution execution; + + public ExecInfo(Execution execution) { + this.execution = execution; + } + + @Override + public String toString() { + return "Process[" + execution.getProcessInstanceId() + + ":" + execution.getId() + "]"; + } + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java new file mode 100644 index 0000000000..0e9e1425a6 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java @@ -0,0 +1,68 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.onap.so.bpmn.common.workflow.service; + +import java.util.Optional; + +import javax.ws.rs.ext.Provider; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.ProcessEngines; +import org.springframework.stereotype.Service; + +/** + * Base class for services that must be process-engine aware. The only + * process engine currently supported is the "default" process engine. + */ +@Service +public class ProcessEngineAwareService { + + private final String processEngineName = "default"; + private volatile Optional<ProcessEngineServices> pes4junit = Optional.empty(); + + /** + * Gets the process engine name. + * @return the process engine name + */ + public String getProcessEngineName() { + return processEngineName; + } + + /** + * Gets process engine services. + * @return process engine services + */ + public ProcessEngineServices getProcessEngineServices() { + return pes4junit.orElse(ProcessEngines.getProcessEngine( + getProcessEngineName())); + } + + /** + * Allows a particular process engine to be specified, overriding the + * usual process engine lookup by name. Intended primarily for the + * unit test environment. + * @param pes process engine services + */ + public void setProcessEngineServices4junit(ProcessEngineServices pes) { + pes4junit = Optional.ofNullable(pes); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java new file mode 100644 index 0000000000..710144dbb9 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java @@ -0,0 +1,91 @@ +/*- + * ============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.onap.so.bpmn.common.workflow.service; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.ws.rs.core.Context; +import javax.xml.ws.WebServiceContext; + +import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest; +import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterResponse; +import org.onap.so.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType; +import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackError; +import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * Implementation of SDNCAdapterCallbackService. + */ +@WebService(serviceName="SDNCAdapterCallbackService", targetNamespace="http://org.onap/workflow/sdnc/adapter/schema/v1") +@Service +public class SDNCAdapterCallbackServiceImpl extends ProcessEngineAwareService implements SDNCCallbackAdapterPortType { + + private final static String logMarker = "[SDNC-CALLBACK]"; + + @Context WebServiceContext wsContext; + + @Autowired + CallbackHandlerService callback; + + @WebMethod(operationName = "SDNCAdapterCallback") + @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") + public SDNCAdapterResponse sdncAdapterCallback( + @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest") + SDNCAdapterCallbackRequest sdncAdapterCallbackRequest) { + + String method = "sdncAdapterCallback"; + Object message = sdncAdapterCallbackRequest; + String messageEventName = "sdncAdapterCallbackRequest"; + String messageVariable = "sdncAdapterCallbackRequest"; + String correlationVariable = "SDNCA_requestId"; + String correlationValue = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId(); + + MsoLogger.setServiceName("MSO." + method); + MsoLogger.setLogContext(correlationValue, "N/A"); + + CallbackResult result = callback.handleCallback(method, message, messageEventName, + messageVariable, correlationVariable, correlationValue, logMarker); + + if (result instanceof CallbackError) { + return new SDNCAdapterErrorResponse(((CallbackError)result).getErrorMessage()); + } else { + return new SDNCAdapterResponse(); + } + } + + // This subclass allows unit tests to extract the error + public class SDNCAdapterErrorResponse extends SDNCAdapterResponse { + private String error; + + public SDNCAdapterErrorResponse(String error) { + this.error = error; + } + + public String getError() { + return error; + } + } +}
\ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java new file mode 100644 index 0000000000..ae9cec9476 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java @@ -0,0 +1,255 @@ +/*- + * ============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.onap.so.bpmn.common.workflow.service; + +import javax.jws.Oneway; +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; +import javax.ws.rs.core.Context; +import javax.xml.ws.Action; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.WebServiceContext; + +import org.onap.so.bpmn.common.adapter.vnf.CreateVnfNotification; +import org.onap.so.bpmn.common.adapter.vnf.DeleteVnfNotification; +import org.onap.so.bpmn.common.adapter.vnf.MsoExceptionCategory; +import org.onap.so.bpmn.common.adapter.vnf.QueryVnfNotification; +import org.onap.so.bpmn.common.adapter.vnf.RollbackVnfNotification; +import org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification; +import org.onap.so.bpmn.common.adapter.vnf.VnfAdapterNotify; +import org.onap.so.bpmn.common.adapter.vnf.VnfRollback; +import org.onap.so.bpmn.common.adapter.vnf.VnfStatus; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * Implementation of the VnfAdapterNotify service. + */ +@WebService(serviceName = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify") +@Service +public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService implements VnfAdapterNotify{ + + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterNotifyServiceImpl.class); + + private final String logMarker = "[VNF-NOTIFY]"; + + @Autowired + CallbackHandlerService callback; + + @Context WebServiceContext wsContext; + + @WebMethod(operationName = "rollbackVnfNotification") + @Oneway + @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.RollbackVnfNotification") + @Action(input = "http://org.onap.so/notify/adapterNotify/rollbackVnfNotificationRequest") + public void rollbackVnfNotification( + @WebParam(name = "messageId", targetNamespace = "") + String messageId, + @WebParam(name = "completed", targetNamespace = "") + boolean completed, + @WebParam(name = "exception", targetNamespace = "") + MsoExceptionCategory exception, + @WebParam(name = "errorMessage", targetNamespace = "") + String errorMessage) { + + RollbackVnfNotification rollbackVnfNotification = new RollbackVnfNotification(); + + rollbackVnfNotification.setMessageId(messageId); + rollbackVnfNotification.setCompleted(completed); + rollbackVnfNotification.setException(exception); + rollbackVnfNotification.setErrorMessage(errorMessage); + + String method = "rollbackVnfNotification"; + Object message = rollbackVnfNotification; + String messageEventName = "rollbackVnfNotificationCallback"; + String messageVariable = "rollbackVnfNotificationCallback"; + String correlationVariable = "VNFRB_messageId"; + String correlationValue = messageId; + + callback.handleCallback(method, message, messageEventName, messageVariable, + correlationVariable, correlationValue, logMarker); + } + + @WebMethod(operationName = "queryVnfNotification") + @Oneway + @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.QueryVnfNotification") + @Action(input = "http://org.onap.so/notify/adapterNotify/queryVnfNotificationRequest") + public void queryVnfNotification( + @WebParam(name = "messageId", targetNamespace = "") + String messageId, + @WebParam(name = "completed", targetNamespace = "") + boolean completed, + @WebParam(name = "exception", targetNamespace = "") + MsoExceptionCategory exception, + @WebParam(name = "errorMessage", targetNamespace = "") + String errorMessage, + @WebParam(name = "vnfExists", targetNamespace = "") + Boolean vnfExists, + @WebParam(name = "vnfId", targetNamespace = "") + String vnfId, + @WebParam(name = "status", targetNamespace = "") + VnfStatus status, + @WebParam(name = "outputs", targetNamespace = "") + QueryVnfNotification.Outputs outputs){ + + String method = "queryVnfNotification"; + String messageEventName = "queryVnfNotificationCallback"; + String messageVariable = "queryVnfNotificationCallback"; + String correlationVariable = "VNFQ_messageId"; + String correlationValue = messageId; + + MsoLogger.setServiceName("MSO." + method); + MsoLogger.setLogContext(correlationValue, "N/A"); + + QueryVnfNotification message = new QueryVnfNotification(); + + message.setMessageId(messageId); + message.setCompleted(completed); + message.setException(exception); + message.setErrorMessage(errorMessage); + message.setVnfExists(vnfExists); + message.setVnfId(vnfId); + message.setStatus(status); + message.setOutputs(outputs); + + callback.handleCallback(method, message, messageEventName, messageVariable, + correlationVariable, correlationValue, logMarker); + } + + @WebMethod(operationName = "createVnfNotification") + @Oneway + @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.CreateVnfNotification") + @Action(input = "http://org.onap.so/notify/adapterNotify/createVnfNotificationRequest") + public void createVnfNotification( + @WebParam(name = "messageId", targetNamespace = "") + String messageId, + @WebParam(name = "completed", targetNamespace = "") + boolean completed, + @WebParam(name = "exception", targetNamespace = "") + MsoExceptionCategory exception, + @WebParam(name = "errorMessage", targetNamespace = "") + String errorMessage, + @WebParam(name = "vnfId", targetNamespace = "") + String vnfId, + @WebParam(name = "outputs", targetNamespace = "") + CreateVnfNotification.Outputs outputs, + @WebParam(name = "rollback", targetNamespace = "") + VnfRollback rollback){ + + String method = "createVnfNotification"; + String messageEventName = "createVnfNotificationCallback"; + String messageVariable = "createVnfNotificationCallback"; + String correlationVariable = "VNFC_messageId"; + String correlationValue = messageId; + + MsoLogger.setServiceName("MSO." + method); + MsoLogger.setLogContext(correlationValue, "N/A"); + + CreateVnfNotification message = new CreateVnfNotification(); + + message.setMessageId(messageId); + message.setCompleted(completed); + message.setException(exception); + message.setErrorMessage(errorMessage); + message.setVnfId(vnfId); + message.setOutputs(outputs); + message.setRollback(rollback); + + callback.handleCallback(method, message, messageEventName, messageVariable, + correlationVariable, correlationValue, logMarker); + } + + @WebMethod(operationName = "updateVnfNotification") + @Oneway + @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.UpdateVnfNotification") + @Action(input = "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest") + public void updateVnfNotification( + @WebParam(name = "messageId", targetNamespace = "") + String messageId, + @WebParam(name = "completed", targetNamespace = "") + boolean completed, + @WebParam(name = "exception", targetNamespace = "") + MsoExceptionCategory exception, + @WebParam(name = "errorMessage", targetNamespace = "") + String errorMessage, + @WebParam(name = "outputs", targetNamespace = "") + UpdateVnfNotification.Outputs outputs, + @WebParam(name = "rollback", targetNamespace = "") + VnfRollback rollback){ + + String method = "updateVnfNotification"; + String messageEventName = "updateVnfNotificationCallback"; + String messageVariable = "updateVnfNotificationCallback"; + String correlationVariable = "VNFU_messageId"; + String correlationValue = messageId; + + MsoLogger.setServiceName("MSO." + method); + MsoLogger.setLogContext(correlationValue, "N/A"); + + UpdateVnfNotification message = new UpdateVnfNotification(); + + message.setMessageId(messageId); + message.setCompleted(completed); + message.setException(exception); + message.setErrorMessage(errorMessage); + message.setOutputs(outputs); + message.setRollback(rollback); + + callback.handleCallback(method, message, messageEventName, messageVariable, + correlationVariable, correlationValue, logMarker); + } + + @WebMethod(operationName = "deleteVnfNotification") + @Oneway + @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.DeleteVnfNotification") + @Action(input = "http://org.onap.so/notify/adapterNotify/deleteVnfNotificationRequest") + public void deleteVnfNotification( + @WebParam(name = "messageId", targetNamespace = "") + String messageId, + @WebParam(name = "completed", targetNamespace = "") + boolean completed, + @WebParam(name = "exception", targetNamespace = "") + MsoExceptionCategory exception, + @WebParam(name = "errorMessage", targetNamespace = "") + String errorMessage) { + + String method = "deleteVnfNotification"; + String messageEventName = "deleteVnfACallback"; + String messageVariable = "deleteVnfACallback"; + String correlationVariable = "VNFDEL_uuid"; + String correlationValue = messageId; + + MsoLogger.setServiceName("MSO." + method); + MsoLogger.setLogContext(correlationValue, "N/A"); + + DeleteVnfNotification message = new DeleteVnfNotification(); + + message.setMessageId(messageId); + message.setCompleted(completed); + message.setException(exception); + message.setErrorMessage(errorMessage); + + callback.handleCallback(method, message, messageEventName, messageVariable, + correlationVariable, correlationValue, logMarker); + } +}
\ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java new file mode 100644 index 0000000000..a9a3a63f2f --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java @@ -0,0 +1,33 @@ +/*- + * ============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.onap.so.bpmn.common.workflow.service; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.ProcessEngines; + + +public class WorkflowAsyncCommonResource extends WorkflowAsyncResource { + + @Override + public String getProcessEngineName() { + return "default"; + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java new file mode 100644 index 0000000000..cfd07d8c39 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java @@ -0,0 +1,244 @@ +/*- + * ============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.onap.so.bpmn.common.workflow.service; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.UUID; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.Provider; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.onap.so.bpmn.common.workflow.context.WorkflowContext; +import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder; +import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; +import org.onap.so.logger.MsoLogger; +import org.slf4j.MDC; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + + +/** + * + * @version 1.0 + * Asynchronous Workflow processing using JAX RS RESTeasy implementation + * Both Synchronous and Asynchronous BPMN process can benefit from this implementation since the workflow gets executed in the background + * and the server thread is freed up, server scales better to process more incoming requests + * + * Usage: For synchronous process, when you are ready to send the response invoke the callback to write the response + * For asynchronous process - the activity may send a acknowledgement response and then proceed further on executing the process + */ +@Path("/async") +@Api(value = "/async", description = "Provides asynchronous starting of a bpmn process") +@Provider +@Component +public class WorkflowAsyncResource extends ProcessEngineAwareService { + + private static final WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance(); + + + protected Optional<ProcessEngineServices> pes4junit = Optional.empty(); + + long workflowPollInterval=1000; + + @Autowired + private WorkflowProcessor processor; + + @Autowired + private WorkflowContextHolder workflowContext; + + public WorkflowProcessor getProcessor() { + return processor; + } + + + + public void setProcessor(WorkflowProcessor processor) { + this.processor = processor; + } + + protected static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,WorkflowAsyncResource.class); + protected static final long DEFAULT_WAIT_TIME = 60000; //default wait time + + /** + * Asynchronous JAX-RS method that starts a process instance. + * @param asyncResponse an object that will receive the asynchronous response + * @param processKey the process key + * @param variableMap input variables to the process + * @return + */ + + @POST + @Path("/services/{processKey}") + @ApiOperation( + value = "Starts a new process with the appropriate process Key", + notes = "Aysnc fall outs are only logged" + ) + @Produces("application/json") + @Consumes("application/json") + public Response startProcessInstanceByKey ( + @PathParam("processKey") String processKey, VariableMapImpl variableMap){ + Map<String, Object> inputVariables = getInputVariables(variableMap); + try { + MDC.put(MsoLogger.REQUEST_ID, getRequestId(inputVariables)); + processor.startProcess(processKey, variableMap); + WorkflowResponse response = waitForResponse(getRequestId(inputVariables)); + return Response.status(202).entity(response).build(); + } catch (Exception e) { + WorkflowResponse response = buildUnkownError(getRequestId(inputVariables),e.getMessage()); + return Response.status(500).entity(response).build(); + } + } + + private WorkflowResponse waitForResponse(String requestId) throws Exception { + long currentWaitTime = 0; + while (DEFAULT_WAIT_TIME > currentWaitTime ) { + Thread.sleep(workflowPollInterval); + currentWaitTime = currentWaitTime + workflowPollInterval; + WorkflowContext foundContext = contextHolder.getWorkflowContext(requestId); + if(foundContext!=null){ + contextHolder.remove(foundContext); + return buildResponse(foundContext); + } + } + throw new Exception("TimeOutOccured"); + } + + private WorkflowResponse buildTimeoutResponse(String requestId) { + WorkflowResponse response = new WorkflowResponse(); + response.setMessage("Fail"); + response.setResponse("Request timedout, request id:" + requestId); + response.setMessageCode(500); + return response; + } + + private WorkflowResponse buildUnkownError(String requestId,String error) { + WorkflowResponse response = new WorkflowResponse(); + response.setMessage(error); + response.setResponse("UnknownError, request id:" + requestId); + response.setMessageCode(500); + return response; + } + + private WorkflowResponse buildResponse(WorkflowContext foundContext) { + return foundContext.getWorkflowResponse(); + } + + protected static String getOrCreate(Map<String, Object> inputVariables, String key) { + String value = Objects.toString(inputVariables.get(key), null); + if (value == null) { + value = UUID.randomUUID().toString(); + inputVariables.put(key, value); + } + return value; + } + + // Note: the business key is used to identify the process in unit tests + protected static String getBusinessKey(Map<String, Object> inputVariables) { + return getOrCreate(inputVariables, "mso-business-key"); + } + + protected static String getRequestId(Map<String, Object> inputVariables) { + return getOrCreate(inputVariables, "mso-request-id"); + } + + + + protected void recordEvents(String processKey, WorkflowResponse response, + long startTime) { + + msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + response.getMessage() + " for processKey: " + + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null); + + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + response.getMessage() + "for processKey: " + processKey + " with response: " + response.getResponse()); + + } + + protected static void setLogContext(String processKey, + Map<String, Object> inputVariables) { + MsoLogger.setServiceName("MSO." + processKey); + if (inputVariables != null) { + MsoLogger.setLogContext(getKeyValueFromInputVariables(inputVariables,"mso-request-id"), getKeyValueFromInputVariables(inputVariables,"serviceInstanceId")); + } + } + + protected static String getKeyValueFromInputVariables(Map<String,Object> inputVariables, String key) { + if (inputVariables == null) { + return ""; + } + + return Objects.toString(inputVariables.get(key), "N/A"); + } + + protected boolean isProcessEnded(String processInstanceId) { + ProcessEngineServices pes = getProcessEngineServices(); + return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null; + } + + protected static Map<String, Object> getInputVariables(VariableMapImpl variableMap) { + Map<String, Object> inputVariables = new HashMap<>(); + @SuppressWarnings("unchecked") + Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables"); + for (Map.Entry<String, Object> entry : vMap.entrySet()) { + String vName = entry.getKey(); + Object value = entry.getValue(); + @SuppressWarnings("unchecked") + Map<String, Object> valueMap = (Map<String,Object>)value; // value, type + inputVariables.put(vName, valueMap.get("value")); + } + return inputVariables; + } + + + protected long getWaitTime(Map<String, Object> inputVariables) + { + + String timeout = Objects.toString(inputVariables.get("mso-service-request-timeout"), null); + + if (timeout != null) { + try { + return Long.parseLong(timeout)*1000; + } catch (NumberFormatException nex) { + msoLogger.debug("Invalid input for mso-service-request-timeout"); + } + } + + return DEFAULT_WAIT_TIME; + } + + + + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java new file mode 100644 index 0000000000..02cda8009f --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java @@ -0,0 +1,124 @@ +/*- + * ============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.onap.so.bpmn.common.workflow.service; + +import java.util.HashMap; +import java.util.Map; + +import javax.ws.rs.Consumes; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackError; +import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +/** + * Generalized REST interface that injects a message event into a waiting BPMN process. + * Examples: + * <pre> + * /WorkflowMessage/SDNCAResponse/6d10d075-100c-42d0-9d84-a52432681cae-1478486185286 + * /WorkflowMessage/SDNCAEvent/USOSTCDALTX0101UJZZ01 + * </pre> + */ +@Path("/") +@Api(description = "Provides a generic service to inject messages into a waiting BPMN Proccess") +@Component +public class WorkflowMessageResource{ + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowMessageResource.class); + private static final String LOGMARKER = "[WORKFLOW-MESSAGE]"; + + @Autowired + CallbackHandlerService callback; + + @POST + @Path("/WorkflowMessage/{messageType}/{correlator}") + @ApiOperation( + value = "Workflow message correlator", + notes = "" + ) + @Consumes("*/*") + @Produces(MediaType.TEXT_PLAIN) + public Response deliver( + @HeaderParam("Content-Type") String contentType, + @PathParam("messageType") String messageType, + @PathParam("correlator") String correlator, + String message) { + + String method = "receiveWorkflowMessage"; + MsoLogger.setServiceName("MSO." + method); + MsoLogger.setLogContext(correlator, "N/A"); + + LOGGER.debug(LOGMARKER + " Received workflow message" + + " type='" + messageType + "'" + + " correlator='" + correlator + "'" + + (contentType == null ? "" : " contentType='" + contentType + "'") + + " message=" + System.lineSeparator() + message); + + if (messageType == null || messageType.isEmpty()) { + String msg = "Missing message type"; + LOGGER.debug(LOGMARKER + " " + msg); + LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg); + return Response.status(400).entity(msg).build(); + } + + if (correlator == null || correlator.isEmpty()) { + String msg = "Missing correlator"; + LOGGER.debug(LOGMARKER + " " + msg); + LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg); + return Response.status(400).entity(msg).build(); + } + + String messageEventName = "WorkflowMessage"; + String messageVariable = messageType + "_MESSAGE"; + String correlationVariable = messageType + "_CORRELATOR"; + String correlationValue = correlator; + String contentTypeVariable = messageType + "_CONTENT_TYPE"; + + Map<String, Object> variables = new HashMap<>(); + + if (contentType != null) { + variables.put(contentTypeVariable, contentType); + } + + CallbackResult result = callback.handleCallback(method, message, messageEventName, + messageVariable, correlationVariable, correlationValue, LOGMARKER, variables); + + if (result instanceof CallbackError) { + return Response.status(500).entity(((CallbackError)result).getErrorMessage()).build(); + } else { + return Response.status(204).build(); + } + } +}
\ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java new file mode 100644 index 0000000000..edc05afba2 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java @@ -0,0 +1,155 @@ +/*- + * ============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.onap.so.bpmn.common.workflow.service; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse; +import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder; +import org.onap.so.logger.MsoLogger; +import org.slf4j.MDC; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + +@Service +public class WorkflowProcessor extends ProcessEngineAwareService { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowProcessor.class); + + protected static final String logMarker = "[WRKFLOW-RESOURCE]"; + protected static final long DEFAULT_WAIT_TIME = 30000; //default wait time + + @Async + public void startProcess( String processKey, VariableMapImpl variableMap) throws InterruptedException + { + MDC.getCopyOfContextMap(); + long startTime = System.currentTimeMillis(); + Map<String, Object> inputVariables = null; + String processInstanceId = null; + try { + inputVariables = getInputVariables(variableMap); + setLogContext(processKey, inputVariables); + + // This variable indicates that the flow was invoked asynchronously + inputVariables.put("isAsyncProcess", "true"); + + + setLogContext(processKey, inputVariables); + + // Note: this creates a random businessKey if it wasn't specified. + String businessKey = getBusinessKey(inputVariables); + + msoLogger.debug("***Received MSO startProcessInstanceByKey with processKey: " + processKey + + " and variables: " + inputVariables); + + RuntimeService runtimeService = getProcessEngineServices().getRuntimeService(); + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processKey, businessKey, + inputVariables); + processInstanceId = processInstance.getId(); + + msoLogger.debug(logMarker + "Process " + processKey + ":" + processInstanceId + " " + + (processInstance.isEnded() ? "ENDED" : "RUNNING")); + } catch (Exception e) { + + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, + logMarker + "Error in starting the process: " + e.getMessage()); + + WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse(); + callbackResponse.setStatusCode(500); + callbackResponse.setMessage("Fail"); + callbackResponse.setResponse("Error occurred while executing the process: " + e); + + WorkflowContextHolder.getInstance().processCallback(processKey, processInstanceId, + getRequestId(inputVariables), callbackResponse); + } + } + + protected static void setLogContext(String processKey, + Map<String, Object> inputVariables) { + MsoLogger.setServiceName("MSO." + processKey); + if (inputVariables != null) { + MsoLogger.setLogContext(getKeyValueFromInputVariables(inputVariables,"mso-request-id"), getKeyValueFromInputVariables(inputVariables,"mso-service-instance-id")); + } + } + + protected static String getKeyValueFromInputVariables(Map<String,Object> inputVariables, String key) { + if (inputVariables == null) { + return ""; + } + + return Objects.toString(inputVariables.get(key), "N/A"); + } + + // Note: the business key is used to identify the process in unit tests + protected static String getBusinessKey(Map<String, Object> inputVariables) { + return getOrCreate(inputVariables, "mso-business-key"); + } + + protected static String getRequestId(Map<String, Object> inputVariables) { + return getOrCreate(inputVariables, "mso-request-id"); + } + + protected static Map<String, Object> getInputVariables(VariableMapImpl variableMap) { + Map<String, Object> inputVariables = new HashMap<>(); + @SuppressWarnings("unchecked") + Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables"); + for (Map.Entry<String, Object> entry : vMap.entrySet()) { + String vName = entry.getKey(); + Object value = entry.getValue(); + @SuppressWarnings("unchecked") + Map<String, Object> valueMap = (Map<String,Object>)value; // value, type + inputVariables.put(vName, valueMap.get("value")); + } + return inputVariables; + } + + protected static String getOrCreate(Map<String, Object> inputVariables, String key) { + String value = Objects.toString(inputVariables.get(key), null); + if (value == null) { + value = UUID.randomUUID().toString(); + inputVariables.put(key, value); + } + return value; + } + + protected long getWaitTime(Map<String, Object> inputVariables) + { + + String timeout = Objects.toString(inputVariables.get("mso-service-request-timeout"), null); + + if (timeout != null) { + try { + return Long.parseLong(timeout)*1000; + } catch (NumberFormatException nex) { + msoLogger.debug("Invalid input for mso-service-request-timeout"); + } + } + + return DEFAULT_WAIT_TIME; + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java new file mode 100644 index 0000000000..c2a7f41140 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java @@ -0,0 +1,630 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.onap.so.bpmn.common.workflow.service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicLong; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + +import org.camunda.bpm.engine.HistoryService; +import org.camunda.bpm.engine.ProcessEngineException; +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.history.HistoricVariableInstance; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.variable.VariableMap; +import org.camunda.bpm.engine.variable.Variables; +import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.slf4j.MDC; +import org.springframework.stereotype.Component; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +@Path("/workflow") +@Api(value = "/workflow", description = "Root of workflow services") +@Component +public class WorkflowResource extends ProcessEngineAwareService { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowResource.class); + private static final String LOGMARKER = "[WRKFLOW-RESOURCE]"; + + private static final int DEFAULT_WAIT_TIME = 30000; + + @Context + private UriInfo uriInfo = null; + + /** + * Starts the process instance and responds to client synchronously + * If the request does not contain mso-service-request-timeout then it waits for the value specified in DEFAULT_WAIT_TIME + * Note: value specified in mso-service-request-timeout is in seconds + * During polling time, if there is an exception encountered in the process execution then polling is stopped and the error response is + * returned to the client + * @param processKey + * @param variableMap + * @return + */ + @POST + @Path("/services/{processKey}") + @ApiOperation( + value = "Starts a new process with the appropriate process synchronously", + notes = "d" + ) + @Produces("application/json") + @Consumes("application/json") + public Response startProcessInstanceByKey(@PathParam("processKey") String processKey, + VariableMapImpl variableMap) { + + Map<String, Object> inputVariables = getInputVariables(variableMap); + setLogContext(processKey, inputVariables); + + WorkflowResponse workflowResponse = new WorkflowResponse(); + long startTime = System.currentTimeMillis(); + ProcessInstance processInstance = null; + + try { + //Kickoff the process + ProcessThread thread = new ProcessThread(inputVariables,processKey,msoLogger); + thread.start(); + + Map<String, Object> responseMap = null; + + //wait for process to be completed + long waitTime = getWaitTime(inputVariables); + long now = System.currentTimeMillis(); + long start = now; + long endTime = start + waitTime; + long pollingInterval = 500; + + // TEMPORARY LOGIC FOR UNIT TEST REFACTORING + // If this is a unit test (method is invoked directly), wait a max + // of 5 seconds after process ended for a result. In production, + // wait up to 60 seconds. + long timeToWaitAfterProcessEnded = uriInfo == null ? 5000 : 60000; + AtomicLong timeProcessEnded = new AtomicLong(0); + boolean endedWithNoResponse = false; + + while (now <= endTime) { + Thread.sleep(pollingInterval); + + now = System.currentTimeMillis(); + + // Increase the polling interval over time + + long elapsed = now - start; + + if (elapsed > 60000) { + pollingInterval = 5000; + } else if (elapsed > 10000) { + pollingInterval = 1000; + } + Exception exception = thread.getException(); + if (exception != null) { + throw new Exception(exception); + } + + processInstance = thread.getProcessInstance(); + + if (processInstance == null) { + msoLogger.debug(LOGMARKER + processKey + " process has not been created yet"); + continue; + } + + String processInstanceId = processInstance.getId(); + workflowResponse.setProcessInstanceID(processInstanceId); + + responseMap = getResponseMap(processInstance, processKey, timeProcessEnded); + + if (responseMap == null) { + msoLogger.debug(LOGMARKER + processKey + " has not produced a response yet"); + + if (timeProcessEnded.longValue() != 0) { + long elapsedSinceEnded = System.currentTimeMillis() - timeProcessEnded.longValue(); + + if (elapsedSinceEnded > timeToWaitAfterProcessEnded) { + endedWithNoResponse = true; + break; + } + } + } else { + processResponseMap(workflowResponse, responseMap); + recordEvents(processKey, workflowResponse, startTime); + return Response.status(workflowResponse.getMessageCode()).entity(workflowResponse).build(); + } + } + + //if we dont get response after waiting then send timeout response + + String state; + String processInstanceId; + + if (processInstance == null) { + processInstanceId = "N/A"; + state = "NOT STARTED"; + } else { + processInstanceId = processInstance.getProcessInstanceId(); + state = isProcessEnded(processInstanceId) ? "ENDED" : "NOT ENDED"; + } + + workflowResponse.setMessage("Fail"); + if (endedWithNoResponse) { + workflowResponse.setResponse("Process ended without producing a response"); + } else { + workflowResponse.setResponse("Request timed out, process state: " + state); + } + workflowResponse.setProcessInstanceID(processInstanceId); + recordEvents(processKey, workflowResponse, startTime); + workflowResponse.setMessageCode(500); + return Response.status(500).entity(workflowResponse).build(); + } catch (Exception ex) { + msoLogger.debug(LOGMARKER + "Exception in startProcessInstance by key",ex); + workflowResponse.setMessage("Fail" ); + workflowResponse.setResponse("Error occurred while executing the process: " + ex.getMessage()); + if (processInstance != null) workflowResponse.setProcessInstanceID(processInstance.getId()); + + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey), + MsoLogger.ErrorCode.UnknownError, LOGMARKER + workflowResponse.getMessage() + + " for processKey: " + processKey + " with response: " + workflowResponse.getResponse()); + + workflowResponse.setMessageCode(500); + recordEvents(processKey, workflowResponse, startTime); + return Response.status(500).entity(workflowResponse).build(); + } + } + + /** + * Returns the wait time, this is used by the resource on how long it should wait to send a response + * If none specified DEFAULT_WAIT_TIME is used + * @param inputVariables + * @return + */ + private int getWaitTime(Map<String, Object> inputVariables) + { + String timeout = inputVariables.get("mso-service-request-timeout") == null + ? null : inputVariables.get("mso-service-request-timeout").toString(); + + if (timeout != null) { + try { + return Integer.parseInt(timeout)*1000; + } catch (NumberFormatException nex) { + msoLogger.debug("Invalid input for mso-service-request-timeout"); + } + } + return DEFAULT_WAIT_TIME; + } + + private void recordEvents(String processKey, WorkflowResponse response, long startTime) { + + msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + LOGMARKER + response.getMessage() + " for processKey: " + + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null); + + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + LOGMARKER + response.getMessage() + " for processKey: " + + processKey + " with response: " + response.getResponse()); + } + + private void setLogContext(String processKey, Map<String, Object> inputVariables) { + MsoLogger.setServiceName("MSO." + processKey); + if (inputVariables != null) { + MsoLogger.setLogContext(getValueFromInputVariables(inputVariables, "mso-request-id"), + getValueFromInputVariables(inputVariables, "mso-service-instance-id")); + } + } + + private String getValueFromInputVariables(Map<String,Object> inputVariables, String key) { + Object value = inputVariables.get(key); + if (value == null) { + return "N/A"; + } else { + return value.toString(); + } + } + + /** + * Checks to see if the specified process is ended. + * @param processInstanceId the process instance ID + * @return true if the process is ended + */ + private boolean isProcessEnded(String processInstanceId) { + ProcessEngineServices pes = getProcessEngineServices(); + try { + return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null ? true : false ; + } catch (Exception e) { + msoLogger.debug("Exception :",e); + return true; + } + } + + private void processResponseMap(WorkflowResponse workflowResponse, Map<String, Object> responseMap) { + Object object = responseMap.get("Response"); + String response = object == null ? null : String.valueOf(object); + if(response == null){ + object = responseMap.get("WorkflowResponse"); + response = object == null ? null : String.valueOf(object); + } + + workflowResponse.setResponse(response); + + object = responseMap.get("ResponseCode"); + String responseCode = object == null ? null : String.valueOf(object); + + try { + workflowResponse.setMessageCode(Integer.parseInt(responseCode)); + } catch(NumberFormatException nex) { + msoLogger.debug(LOGMARKER + "Failed to parse ResponseCode: " + responseCode); + workflowResponse.setMessageCode(-1); + } + + Object status = responseMap.get("Status"); + + if ("Success".equalsIgnoreCase(String.valueOf(status))) { + workflowResponse.setMessage("Success"); + } else if ("Fail".equalsIgnoreCase(String.valueOf(status))) { + workflowResponse.setMessage("Fail"); + } else { + msoLogger.debug(LOGMARKER + "Unrecognized Status: " + responseCode); + workflowResponse.setMessage("Fail"); + } + } + + /** + * @version 1.0 + * Triggers the workflow in a separate thread + */ + private class ProcessThread extends Thread { + private final Map<String,Object> inputVariables; + private final String processKey; + private final MsoLogger msoLogger; + private final String businessKey; + private ProcessInstance processInstance = null; + private Exception exception = null; + + public ProcessThread(Map<String, Object> inputVariables, String processKey, MsoLogger msoLogger) { + this.inputVariables = inputVariables; + this.processKey = processKey; + this.msoLogger = msoLogger; + this.businessKey = UUID.randomUUID().toString(); + } + + /** + * If an exception occurs when starting the process instance, it may + * be obtained by calling this method. Note that exceptions are only + * recorded while the process is executing in its original thread. + * Once a process is suspended, exception recording stops. + * @return the exception, or null if none has occurred + */ + public Exception getException() { + return exception; + } + + + public ProcessInstance getProcessInstance() { + return this.processInstance; + } + + /** + * Sets the process instance exception. + * @param exception the exception + */ + private void setException(Exception exception) { + this.exception = exception; + } + + public void run() { + setLogContext(processKey, inputVariables); + + long startTime = System.currentTimeMillis(); + + try { + msoLogger.debug(LOGMARKER + "***Received MSO startProcessInstanceByKey with processKey:" + + processKey + " and variables: " + inputVariables); + + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER + + "Call to MSO workflow/services in Camunda. Received MSO startProcessInstanceByKey with" + + " processKey:" + processKey + + " businessKey:" + businessKey + + " variables: " + inputVariables); + + RuntimeService runtimeService = getProcessEngineServices().getRuntimeService(); + + // Note that this method doesn't return until the process suspends + // itself or finishes. We provide a business key so we can identify + // the process instance immediately. + processInstance = runtimeService.startProcessInstanceByKey( + processKey, inputVariables); + + } catch (Exception e) { + msoLogger.debug(LOGMARKER + "ProcessThread caught an exception executing " + + processKey + ": " + e); + setException(e); + } + } + + } + + private Map<String, Object> getInputVariables(VariableMapImpl variableMap) { + VariableMap inputVariables = Variables.createVariables(); + @SuppressWarnings("unchecked") + Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables"); + for (String key : vMap.keySet()) { //variabe name vn + @SuppressWarnings("unchecked") + Map<String, Object> valueMap = (Map<String,Object>)vMap.get(key); //value, type + inputVariables.putValueTyped(key, Variables + .objectValue(valueMap.get("value")) + .serializationDataFormat(SerializationDataFormats.JAVA) // tells the engine to use java serialization for persisting the value + .create()); + } + return inputVariables; + } + + /** + * Attempts to get a response map from the specified process instance. + * @return the response map, or null if it is unavailable + */ + private Map<String, Object> getResponseMap(ProcessInstance processInstance, + String processKey, AtomicLong timeProcessEnded) { + + String responseMapVariable = processKey + "ResponseMap"; + String processInstanceId = processInstance.getId(); + + // Query the runtime service to see if a response map is ready. + +/* RuntimeService runtimeService = getProcessEngineServices().getRuntimeService(); + List<Execution> executions = runtimeService.createExecutionQuery() + .processInstanceId(processInstanceId).list(); + + for (Execution execution : executions) { + @SuppressWarnings("unchecked") + Map<String, Object> responseMap = (Map<String, Object>) + getVariableFromExecution(runtimeService, execution.getId(), + responseMapVariable); + + if (responseMap != null) { + msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable + + " from process " + processInstanceId + " execution " + + execution.getId()); + return responseMap; + } + } +*/ + //Querying history seem to return consistent results compared to querying the runtime service + + boolean alreadyEnded = timeProcessEnded.longValue() != 0; + + if (alreadyEnded || isProcessEnded(processInstance.getId())) { + if (!alreadyEnded) { + timeProcessEnded.set(System.currentTimeMillis()); + } + + // Query the history service to see if a response map exists. + + HistoryService historyService = getProcessEngineServices().getHistoryService(); + @SuppressWarnings("unchecked") + Map<String, Object> responseMap = (Map<String, Object>) + getVariableFromHistory(historyService, processInstance.getId(), + responseMapVariable); + + if (responseMap != null) { + msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable + + " from process " + processInstanceId + " history"); + return responseMap; + } + + // Query the history service for old-style response variables. + + String prefix = (String) getVariableFromHistory(historyService, processInstanceId, "prefix"); + + if (prefix != null) { + + // Check for 'WorkflowResponse' variable + Object workflowResponseObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowResponse"); + String workflowResponse = workflowResponseObject == null ? null : String.valueOf(workflowResponseObject); + msoLogger.debug(LOGMARKER + "WorkflowResponse: " + workflowResponse); + + if (workflowResponse != null) { + Object responseCodeObject = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode"); + String responseCode = responseCodeObject == null ? null : String.valueOf(responseCodeObject); + msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); + responseMap = new HashMap<>(); + responseMap.put("WorkflowResponse", workflowResponse); + responseMap.put("ResponseCode", responseCode); + responseMap.put("Status", "Success"); + return responseMap; + } + + + // Check for 'WorkflowException' variable + WorkflowException workflowException = null; + String workflowExceptionText = null; + + Object workflowExceptionObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowException"); + if(workflowExceptionObject != null) { + if(workflowExceptionObject instanceof WorkflowException) { + workflowException = (WorkflowException) workflowExceptionObject; + workflowExceptionText = workflowException.toString(); + responseMap = new HashMap<>(); + responseMap.put("WorkflowException", workflowExceptionText); + responseMap.put("ResponseCode", workflowException.getErrorCode()); + responseMap.put("Status", "Fail"); + return responseMap; + } + else if (workflowExceptionObject instanceof String) { + Object object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode"); + String responseCode = object == null ? null : String.valueOf(object); + workflowExceptionText = (String) workflowExceptionObject; + responseMap = new HashMap<>(); + responseMap.put("WorkflowException", workflowExceptionText); + responseMap.put("ResponseCode", responseCode); + responseMap.put("Status", "Fail"); + return responseMap; + } + + } + msoLogger.debug(LOGMARKER + "WorkflowException: " + workflowExceptionText); + + // BEGIN LEGACY SUPPORT. TODO: REMOVE THIS CODE + Object object = getVariableFromHistory(historyService, processInstanceId, processKey + "Response"); + String response = object == null ? null : String.valueOf(object); + msoLogger.debug(LOGMARKER + processKey + "Response: " + response); + + if (response != null) { + object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode"); + String responseCode = object == null ? null : String.valueOf(object); + msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); + responseMap = new HashMap<>(); + responseMap.put("Response", response); + responseMap.put("ResponseCode", responseCode); + responseMap.put("Status", "Success"); + return responseMap; + } + + object = getVariableFromHistory(historyService, processInstanceId, prefix + "ErrorResponse"); + String errorResponse = object == null ? null : String.valueOf(object); + msoLogger.debug(LOGMARKER + prefix + "ErrorResponse: " + errorResponse); + + if (errorResponse != null) { + object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode"); + String responseCode = object == null ? null : String.valueOf(object); + msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); + responseMap = new HashMap<>(); + responseMap.put("Response", errorResponse); + responseMap.put("ResponseCode", responseCode); + responseMap.put("Status", "Fail"); + return responseMap; + } + // END LEGACY SUPPORT. TODO: REMOVE THIS CODE + } + } + return null; + } + + /** + * Gets a variable value from the specified execution. + * @return the variable value, or null if the variable could not be + * obtained + */ + private Object getVariableFromExecution(RuntimeService runtimeService, + String executionId, String variableName) { + try { + return runtimeService.getVariable(executionId, variableName); + } catch (ProcessEngineException e) { + // Most likely cause is that the execution no longer exists. + msoLogger.debug("Error retrieving execution " + executionId + + " variable " + variableName + ": " + e); + return null; + } + } + /** + * Gets a variable value from specified historical process instance. + * @return the variable value, or null if the variable could not be + * obtained + */ + private Object getVariableFromHistory(HistoryService historyService, + String processInstanceId, String variableName) { + try { + HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery() + .processInstanceId(processInstanceId).variableName(variableName).singleResult(); + return v == null ? null : v.getValue(); + } catch (Exception e) { + msoLogger.debug("Error retrieving process " + processInstanceId + + " variable " + variableName + " from history: " + e); + return null; + } + } + + @POST + @Path("/services/{processKey}/{processInstanceId}") + @Produces("application/json") + @Consumes("application/json") + @ApiOperation( + value = "Allows for retrieval of the variables for a given process", + notes = "" + ) + public WorkflowResponse getProcessVariables(@PathParam("processKey") String processKey, @PathParam("processInstanceId") String processInstanceId) { + //TODO filter only set of variables + WorkflowResponse response = new WorkflowResponse(); + + long startTime = System.currentTimeMillis(); + try { + ProcessEngineServices engine = getProcessEngineServices(); + List<HistoricVariableInstance> variables = engine.getHistoryService().createHistoricVariableInstanceQuery().processInstanceId(processInstanceId).list(); + Map<String,String> variablesMap = new HashMap<>(); + for (HistoricVariableInstance variableInstance: variables) { + variablesMap.put(variableInstance.getName(), variableInstance.getValue().toString()); + } + + msoLogger.debug(LOGMARKER + "***Received MSO getProcessVariables with processKey:" + processKey + " and variables: " + variablesMap.toString()); + + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER + + "Call to MSO workflow/services in Camunda. Received MSO getProcessVariables with processKey:" + + processKey + " and variables: " + + variablesMap.toString()); + + + response.setVariables(variablesMap); + response.setMessage("Success"); + response.setResponse("Successfully retrieved the variables"); + response.setProcessInstanceID(processInstanceId); + + msoLogger.debug(LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response.getResponse()); + } catch (Exception ex) { + response.setMessage("Fail"); + response.setResponse("Failed to retrieve the variables," + ex.getMessage()); + response.setProcessInstanceID(processInstanceId); + + msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey), MsoLogger.ErrorCode.UnknownError, LOGMARKER + + response.getMessage() + + " for processKey: " + + processKey + + " with response: " + + response.getResponse()); + msoLogger.debug("Exception :",ex); + } + + msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + LOGMARKER + response.getMessage() + " for processKey: " + + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null); + + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + LOGMARKER + response.getMessage() + " for processKey: " + + processKey + " with response: " + response.getResponse()); + + return response; + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java new file mode 100644 index 0000000000..00ee6eb235 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java @@ -0,0 +1,353 @@ +/*- + * ============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.onap.so.bpmn.core.plugins; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; +import java.util.concurrent.ConcurrentHashMap; + +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.ExecutionListener; +import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener; +import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener; +import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin; +import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.camunda.bpm.engine.impl.context.Context; +import org.camunda.bpm.engine.impl.interceptor.Command; +import org.camunda.bpm.engine.impl.interceptor.CommandContext; +import org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity; +import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl; +import org.camunda.bpm.engine.impl.pvm.process.ScopeImpl; +import org.camunda.bpm.engine.impl.pvm.process.TransitionImpl; +import org.camunda.bpm.engine.impl.util.xml.Element; +import org.camunda.bpm.engine.impl.variable.VariableDeclaration; +import org.camunda.bpm.model.bpmn.impl.instance.FlowNodeImpl; +import org.camunda.bpm.model.bpmn.instance.EndEvent; +import org.camunda.bpm.model.bpmn.instance.FlowNode; +import org.camunda.bpm.model.bpmn.instance.StartEvent; +import org.onap.so.bpmn.core.BPMNLogger; + + +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.slf4j.MDC; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.AbstractEnvironment; +import org.springframework.core.env.Environment; +import org.springframework.core.env.MapPropertySource; +import org.springframework.core.env.PropertySource; +import org.springframework.stereotype.Component; + + + +/** + * Plugin for MSO logging and URN mapping. + */ +@Component +public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { + private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, LoggingAndURNMappingPlugin.class); + private static final String FSPROPKEY = "URNMapping.FileSystemLoading.Enabled"; + + @Autowired + private LoggingParseListener loggingParseListener; + + @Override + public void preInit( + ProcessEngineConfigurationImpl processEngineConfiguration) { + List<BpmnParseListener> preParseListeners = processEngineConfiguration + .getCustomPreBPMNParseListeners(); + if (preParseListeners == null) { + preParseListeners = new ArrayList<>(); + processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners); + } + preParseListeners.add(loggingParseListener); + } + + /** + * Called when a process flow is parsed so we can inject listeners. + */ + @Component + public class LoggingParseListener extends AbstractBpmnParseListener { + + + private void injectLogExecutionListener(ActivityImpl activity) { + activity.addListener( + ExecutionListener.EVENTNAME_END, + new LoggingExecutionListener("END")); + + activity.addListener( + ExecutionListener.EVENTNAME_START, + new LoggingExecutionListener("START")); + + activity.addListener( + ExecutionListener.EVENTNAME_TAKE, + new LoggingExecutionListener("TAKE")); + } + + @Override + public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) { + } + + @Override + public void parseStartEvent(Element startEventElement, ScopeImpl scope, ActivityImpl startEventActivity) { + // Inject these listeners only on the main start event for the flow, not on any embedded subflow start events + + injectLogExecutionListener(startEventActivity); + } + + @Override + public void parseServiceTask(Element serviceTaskElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseExclusiveGateway(Element exclusiveGwElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseInclusiveGateway(Element inclusiveGwElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseParallelGateway(Element parallelGwElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseScriptTask(Element scriptTaskElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseBusinessRuleTask(Element businessRuleTaskElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseTask(Element taskElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseManualTask(Element manualTaskElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseUserTask(Element userTaskElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseEndEvent(Element endEventElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseBoundaryTimerEventDefinition(Element timerEventDefinition, boolean interrupting, ActivityImpl timerActivity) { + injectLogExecutionListener(timerActivity); + } + + @Override + public void parseBoundaryErrorEventDefinition(Element errorEventDefinition, boolean interrupting, ActivityImpl activity, ActivityImpl nestedErrorEventActivity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseSubProcess(Element subProcessElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseCallActivity(Element callActivityElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseProperty(Element propertyElement, VariableDeclaration variableDeclaration, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseSequenceFlow(Element sequenceFlowElement, ScopeImpl scopeElement, TransitionImpl transition) { + //injectLogExecutionListener(activity); + } + + @Override + public void parseSendTask(Element sendTaskElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseMultiInstanceLoopCharacteristics(Element activityElement, Element multiInstanceLoopCharacteristicsElement, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseIntermediateTimerEventDefinition(Element timerEventDefinition, ActivityImpl timerActivity) { + injectLogExecutionListener(timerActivity); + } + + @Override + public void parseRootElement(Element rootElement, List<ProcessDefinitionEntity> processDefinitions) { + //injectLogExecutionListener(activity); + } + + @Override + public void parseReceiveTask(Element receiveTaskElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseIntermediateSignalCatchEventDefinition(Element signalEventDefinition, ActivityImpl signalActivity) { + injectLogExecutionListener(signalActivity); + } + + @Override + public void parseBoundarySignalEventDefinition(Element signalEventDefinition, boolean interrupting, ActivityImpl signalActivity) { + injectLogExecutionListener(signalActivity); + } + + @Override + public void parseEventBasedGateway(Element eventBasedGwElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseTransaction(Element transactionElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseCompensateEventDefinition(Element compensateEventDefinition, ActivityImpl compensationActivity) { + injectLogExecutionListener(compensationActivity); + } + + @Override + public void parseIntermediateThrowEvent(Element intermediateEventElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseIntermediateCatchEvent(Element intermediateEventElement, ScopeImpl scope, ActivityImpl activity) { + injectLogExecutionListener(activity); + } + + @Override + public void parseBoundaryEvent(Element boundaryEventElement, ScopeImpl scopeElement, ActivityImpl nestedActivity) { + injectLogExecutionListener(nestedActivity); + } + + @Override + public void parseIntermediateMessageCatchEventDefinition(Element messageEventDefinition, ActivityImpl nestedActivity) { + injectLogExecutionListener(nestedActivity); + } + + @Override + public void parseBoundaryMessageEventDefinition(Element element, boolean interrupting, ActivityImpl messageActivity) { + injectLogExecutionListener(messageActivity); + } + } + + /** + * Logs details about the current activity. + */ + public class LoggingExecutionListener implements ExecutionListener { + private final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,LoggingExecutionListener.class); + + private String event; + + public LoggingExecutionListener() { + this.event = ""; + } + + public LoggingExecutionListener(String event) { + this.event = event; + } + + public String getEvent() { + return event; + } + + @Override + public void notify(DelegateExecution execution) throws Exception { + logger.trace("Logging for activity---------------:" + event + ":" + + execution.getCurrentActivityName() + + ", processDefinitionId=" + + execution.getProcessDefinitionId() + ", activtyId=" + + execution.getCurrentActivityId() + ", activtyName='" + + execution.getCurrentActivityName() + "'" + + ", processInstanceId=" + + execution.getProcessInstanceId() + ", businessKey=" + + execution.getProcessBusinessKey() + ", executionId=" + + execution.getId()); + //required for legacy groovy processing in camunda + execution.setVariable("isDebugLogEnabled", "true"); + if (!isBlank(execution.getCurrentActivityName())) { + try { + + String id = execution.getId(); + if (id != null ) { + RepositoryService repositoryService = execution.getProcessEngineServices().getRepositoryService(); + String processName = repositoryService.createProcessDefinitionQuery() + .processDefinitionId(execution.getProcessDefinitionId()) + .singleResult() + .getName(); + + if (execution.getBpmnModelElementInstance() instanceof StartEvent) { + logger.debug("Starting process: " + processName); + } + if (execution.getBpmnModelElementInstance() instanceof EndEvent) { + logger.debug("Ending process: " + processName); + } + + String serviceName = MDC.get(MsoLogger.SERVICE_NAME); + + if(serviceName != null && !serviceName.contains(processName)) + MsoLogger.setServiceName( serviceName + "." + processName); + else if(serviceName == null) + MsoLogger.setServiceName(processName); + + String requestId = (String) execution.getVariable("mso-request-id"); + String svcid = (String) execution.getVariable("mso-service-instance-id"); + MsoLogger.setLogContext(requestId, svcid); + } + } catch(Exception e) { + logger.error(e); + } + } + } + + private boolean isBlank(Object object) { + return object == null || "".equals(object.toString().trim()); + } + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java new file mode 100644 index 0000000000..9b8f6cd5cc --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java @@ -0,0 +1,172 @@ +/*- + * ============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.onap.so.bpmn.core.plugins; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.ExecutionListener; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.camunda.bpm.engine.impl.bpmn.behavior.ClassDelegateActivityBehavior; +import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener; +import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener; +import org.camunda.bpm.engine.impl.bpmn.parser.FieldDeclaration; +import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin; +import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity; +import org.camunda.bpm.engine.impl.pvm.PvmTransition; +import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl; +import org.camunda.bpm.engine.impl.pvm.process.TransitionImpl; +import org.camunda.bpm.engine.impl.util.xml.Element; + +import org.onap.so.bpmn.core.BPMNLogger; +import org.onap.so.bpmn.core.WorkflowException; +import org.springframework.stereotype.Component; + +/** + * This plugin does the following: + * <ol> + * <li> + * Adds logic at the start of every Call Activity to remove any existing + * WorkflowException object from the execution (saving a copy of it in a + * different variable). + * </li> + * <li> + * Adds logic at the end of every Call Activity to generate a MSOWorkflowException + * event if there is a WorkflowException object in the execution. + * </li> + * </ol> + */ +@Component +public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin { + + @Override + public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) { + List<BpmnParseListener> preParseListeners = + processEngineConfiguration.getCustomPreBPMNParseListeners(); + + if (preParseListeners == null) { + preParseListeners = new ArrayList<>(); + processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners); + } + + preParseListeners.add(new WorkflowExceptionParseListener()); + } + + public static class WorkflowExceptionParseListener extends AbstractBpmnParseListener { + @Override + public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) { + AtomicInteger triggerTaskIndex = new AtomicInteger(1); + List<ActivityImpl> activities = new ArrayList<>(processDefinition.getActivities()); + recurse(activities, triggerTaskIndex); + } + + /** + * Helper method that recurses (into subprocesses) over all the listed activities. + * @param activities a list of workflow activities + * @param triggerTaskIndex the index of the next trigger task (mutable) + */ + private void recurse(List<ActivityImpl> activities, AtomicInteger triggerTaskIndex) { + for (ActivityImpl activity : activities) { + String type = (String) activity.getProperty("type"); + + if ("callActivity".equals(type)) { + // Add a WorkflowExceptionResetListener to clear the WorkflowException + // variable when each Call Activity starts. + + activity.addListener( + ExecutionListener.EVENTNAME_START, + new WorkflowExceptionResetListener()); + + // Add a WorkflowExceptionTriggerTask after the call activity. + // It must be a task because a listener cannot be used to generate + // an event. Throwing BpmnError from an execution listener will + // cause the process to die. + + List<PvmTransition> outTransitions = + new ArrayList<>(activity.getOutgoingTransitions()); + + for (PvmTransition transition : outTransitions) { + String triggerTaskId = "WorkflowExceptionTriggerTask_" + triggerTaskIndex; + + ActivityImpl triggerTask = activity.getFlowScope().createActivity(triggerTaskId); + + ClassDelegateActivityBehavior behavior = new ClassDelegateActivityBehavior( + WorkflowExceptionTriggerTask.class.getName(), + new ArrayList<>(0)); + + triggerTask.setActivityBehavior(behavior); + triggerTask.setName("Workflow Exception Trigger Task " + triggerTaskIndex); + triggerTaskIndex.getAndIncrement(); + + TransitionImpl transitionImpl = (TransitionImpl) transition; + TransitionImpl triggerTaskOutTransition = triggerTask.createOutgoingTransition(); + triggerTaskOutTransition.setDestination((ActivityImpl)transitionImpl.getDestination()); + transitionImpl.setDestination(triggerTask); + } + } else if ("subProcess".equals(type)) { + recurse(new ArrayList<>(activity.getActivities()), triggerTaskIndex); + } + } + } + } + + /** + * If there is a WorkflowException object in the execution, this method + * removes it (saving a copy of it in a different variable). + */ + public static class WorkflowExceptionResetListener implements ExecutionListener { + public void notify(DelegateExecution execution) throws Exception { + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + int index = 1; + String saveName = "SavedWorkflowException" + index; + while (execution.getVariable(saveName) != null) { + saveName = "SavedWorkflowException" + (++index); + } + + BPMNLogger.debug((String)execution.getVariable("isDebugLogEnabled"), + "WorkflowExceptionResetTask is moving WorkflowException to " + saveName); + + execution.setVariable(saveName, workflowException); + execution.setVariable("WorkflowException", null); + } + } + } + + /** + * Generates an MSOWorkflowException event if there is a WorkflowException + * object in the execution. + */ + public static class WorkflowExceptionTriggerTask implements JavaDelegate { + public void execute(DelegateExecution execution) throws Exception { + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + BPMNLogger.debug((String)execution.getVariable("isDebugLogEnabled"), + "WorkflowExceptionTriggerTask is generating a MSOWorkflowException event"); + throw new BpmnError("MSOWorkflowException"); + } + } + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java new file mode 100644 index 0000000000..8fe7ebe93a --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java @@ -0,0 +1,122 @@ +/*- + * ============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.onap.so.bpmn.infrastructure; + +import java.util.Arrays; + +import javax.xml.ws.Endpoint; + +import org.apache.cxf.Bus; +import org.apache.cxf.endpoint.Server; +import org.apache.cxf.feature.LoggingFeature; +import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; +import org.apache.cxf.jaxrs.swagger.Swagger2Feature; +import org.apache.cxf.jaxws.EndpointImpl; +import org.apache.cxf.transport.servlet.CXFServlet; +import org.onap.so.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType; +import org.onap.so.bpmn.common.adapter.vnf.VnfAdapterNotify; +import org.onap.so.bpmn.common.workflow.service.WorkflowAsyncResource; +import org.onap.so.bpmn.common.workflow.service.WorkflowMessageResource; +import org.onap.so.bpmn.common.workflow.service.WorkflowResource; +import org.onap.so.logger.MsoLogger; +import org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; + + +@Configuration +public class CXFConfiguration { + + private static final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CXFConfiguration.class); + + @Autowired + private Bus bus; + + @Autowired + private WorkflowMessageResource wmr; + + @Autowired + private WorkflowResource workflowResource; + + @Autowired + private WorkflowAsyncResource workflowAsyncResource; + + @Autowired + private JaxRsFilterLogging jaxRsFilterLogging; + + @Autowired + private ObjectMapper mapper; + + @Autowired + private SDNCCallbackAdapterPortType sdncAdapterCallbackServiceImpl; + + @Autowired + private VnfAdapterNotify vnfAdapterNotifyServiceImpl; + + @Bean + public ServletRegistrationBean cxfServlet() { + return new ServletRegistrationBean(new CXFServlet(), "/mso/*"); + } + + @Bean + public Endpoint vnfAdapterCallback() { + EndpointImpl endpoint = new EndpointImpl(bus, vnfAdapterNotifyServiceImpl); + endpoint.publish("/VNFAdaptercallback"); + return endpoint; + } + + @Bean + public Endpoint sndcAdapterCallback() { + EndpointImpl endpoint = new EndpointImpl(bus, sdncAdapterCallbackServiceImpl); + endpoint.publish("/SDNCAdapterCallbackService"); + return endpoint; + } + + @Bean + public Server rsServer() { + JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean(); + endpoint.setBus(bus); + endpoint.setServiceBeans(Arrays.<Object>asList(wmr, workflowResource, workflowAsyncResource)); + endpoint.setAddress("/"); + endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature())); + endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper),jaxRsFilterLogging)); + + return endpoint.create(); + } + + @Bean + public Swagger2Feature createSwaggerFeature() { + Swagger2Feature swagger2Feature= new Swagger2Feature(); + swagger2Feature.setPrettyPrint(true); + swagger2Feature.setTitle("SO Orchestration Application"); + swagger2Feature.setContact("The ONAP SO team"); + swagger2Feature.setDescription("This project is the SO Orchestration Engine"); + swagger2Feature.setVersion("1.0.0"); + swagger2Feature.setResourcePackage("org.onap.so.bpmn.common.workflow.service"); + swagger2Feature.setScan(true); + return swagger2Feature; + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java new file mode 100644 index 0000000000..c263fe636c --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java @@ -0,0 +1,117 @@ +/*- + * ============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.onap.so.bpmn.infrastructure; + +import java.util.List; +import java.util.concurrent.Executor; + +import org.camunda.bpm.application.PostDeploy; +import org.camunda.bpm.application.PreUndeploy; +import org.camunda.bpm.application.ProcessApplicationInfo; +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; +import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; +import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl; +import org.onap.so.logger.MsoLogger; +import org.onap.so.requestsdb.RequestsDBHelper; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.ComponentScan.Filter; +import org.springframework.context.annotation.FilterType; +import org.springframework.context.annotation.Primary; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +/** + * @since Version 1.0 + * + */ + +@SpringBootApplication +@EnableProcessApplication("MSO Infrastructure Application") +@EnableAsync +@ComponentScan(basePackages = { "org.onap" }, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = { + @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) }) +public class MSOInfrastructureApplication { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, + MSOInfrastructureApplication.class); + + @Value("${mso.async.core-pool-size}") + private int corePoolSize; + + @Value("${mso.async.max-pool-size}") + private int maxPoolSize; + + @Value("${mso.async.queue-capacity}") + private int queueCapacity; + + private static final String LOGS_DIR = "logs_dir"; + + + private static void setLogsDir() { + if (System.getProperty(LOGS_DIR) == null) { + System.getProperties().setProperty(LOGS_DIR, "./logs/bpmn/"); + } + } + + public static void main(String... args) { + SpringApplication.run(MSOInfrastructureApplication.class, args); + System.getProperties().setProperty("mso.config.path", "."); + setLogsDir(); + } + + @PostDeploy + public void postDeploy(ProcessEngine processEngineInstance) { + long startTime = System.currentTimeMillis(); + + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Post deployment complete..."); + } + + @PreUndeploy + public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo, + List<ProcessEngine> processEngines) { + long startTime = System.currentTimeMillis(); + + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Pre Undeploy complete..."); + + } + + @Bean + @Primary + public Executor asyncExecutor() { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + + executor.setCorePoolSize(corePoolSize); + executor.setMaxPoolSize(maxPoolSize); + executor.setQueueCapacity(queueCapacity); + executor.setThreadNamePrefix("Camunda-"); + executor.initialize(); + return executor; + } +}
\ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java new file mode 100644 index 0000000000..ad9e210452 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.onap.so.bpmn.infrastructure; + +import org.onap.so.security.MSOSpringFirewall; +import org.onap.so.security.WebSecurityConfig; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.builders.WebSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.web.firewall.StrictHttpFirewall; +import org.springframework.util.StringUtils; + +@EnableWebSecurity +public class WebSecurityConfigImpl extends WebSecurityConfig { + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.csrf().disable() + .authorizeRequests() + .antMatchers("/manage/health","/manage/info").permitAll() + .antMatchers("/async/services/**", "/workflow/services/*", "/SDNCAdapterCallbackService", "/WorkflowMessage", "/vnfAdapterNotify", "/vnfAdapterRestNotify") + .hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),",").toString()) + .and() + .httpBasic(); + } + + @Override + public void configure(WebSecurity web) throws Exception { + super.configure(web); + StrictHttpFirewall firewall = new MSOSpringFirewall(); + web.httpFirewall(firewall); + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java new file mode 100644 index 0000000000..e4866f5334 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java @@ -0,0 +1,57 @@ +/*- + * ============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.onap.so.bpmn.infrastructure.pnf.delegate; + +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.onap.so.bpmn.common.scripts.ExceptionUtil; +import org.onap.so.logger.MsoLogger; + +public class PnfCheckInputs implements JavaDelegate { + + private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, PnfCheckInputs.class); + + private String defaultTimeout; + + @Override + public void execute(DelegateExecution execution) throws Exception { + String correlationId = (String) execution.getVariable(CORRELATION_ID); + if (correlationId == null) { + new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "correlationId variable not defined"); + } + String timeout = (String) execution.getVariable(TIMEOUT_FOR_NOTIFICATION); + if (timeout == null) { + LOGGER.debug("timeoutForPnfEntryNotification variable not found, setting default"); + if (defaultTimeout == null) { + new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, + "default timeoutForPnfEntryNotification value not defined"); + } + execution.setVariable(TIMEOUT_FOR_NOTIFICATION, defaultTimeout); + } + } + + public void setDefaultTimeout(String defaultTimeout) { + this.defaultTimeout = defaultTimeout; + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java new file mode 100644 index 0000000000..bd781756a5 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java @@ -0,0 +1,422 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.onap.so.bpmn.infrastructure.workflow.service; + +import java.io.IOException; +import java.net.SocketTimeoutException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.apache.http.HttpResponse; +import org.apache.http.ParseException; +import org.apache.http.client.HttpClient; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.conn.ConnectTimeoutException; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.camunda.bpm.engine.runtime.Execution; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.bpmn.core.domain.ServiceDecomposition; +import org.onap.so.bpmn.core.json.JsonUtils; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +public class ServicePluginFactory { + + // SOTN calculate route + public static final String OOF_Default_EndPoint = "http://192.168.1.223:8443/oof/sotncalc"; + + public static final String Third_SP_Default_EndPoint = "http://192.168.1.223:8443/sp/resourcemgr/querytps"; + + private static final int DEFAULT_TIME_OUT = 60000; + + static JsonUtils jsonUtil = new JsonUtils(); + + private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ServicePluginFactory.class); + + private static ServicePluginFactory instance; + + + public static synchronized ServicePluginFactory getInstance() { + if (null == instance) { + instance = new ServicePluginFactory(); + } + return instance; + } + + private String getThirdSPEndPoint(){ + return UrnPropertiesReader.getVariable("mso.service-plugin.third-sp-endpoint", Third_SP_Default_EndPoint); + } + + private String getOOFCalcEndPoint(){ + return UrnPropertiesReader.getVariable("mso.service-plugin.oof-calc-endpoint", OOF_Default_EndPoint); + } + + + public String preProcessService(ServiceDecomposition serviceDecomposition, String uuiRequest) { + + // now only for sotn + if (isSOTN(serviceDecomposition, uuiRequest)) { + // We Need to query the terminalpoint of the VPN by site location + // info + return preProcessSOTNService(serviceDecomposition, uuiRequest); + } + return uuiRequest; + } + + public String doServiceHoming(ServiceDecomposition serviceDecomposition, String uuiRequest) { + // now only for sotn + if (isSOTN(serviceDecomposition, uuiRequest)) { + return doSOTNServiceHoming(serviceDecomposition, uuiRequest); + } + return uuiRequest; + } + + private boolean isSOTN(ServiceDecomposition serviceDecomposition, String uuiRequest) { + // there should be a register platform , we check it very simple here. + return uuiRequest.contains("clientSignal") && uuiRequest.contains("vpnType"); + } + + private String preProcessSOTNService(ServiceDecomposition serviceDecomposition, String uuiRequest) { + Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class); + Map<String, Object> serviceObject = (Map<String, Object>) uuiObject.get("service"); + Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject.get("parameters"); + Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject.get("requestInputs"); + List<Object> resources = (List<Object>) serviceParametersObject.get("resources"); + // This is a logic for demo , it could not be finalized to community. + String srcLocation = ""; + String dstLocation = ""; + String srcClientSignal = ""; + String dstClientSignal = ""; + // support R2 uuiReq and R1 uuiReq + // logic for R2 uuiRequest params in service level + for (Entry<String, Object> entry : serviceRequestInputs.entrySet()) { + if (entry.getKey().toLowerCase().contains("location")) { + if ("".equals(srcLocation)) { + srcLocation = (String) entry.getValue(); + } else if ("".equals(dstLocation)) { + dstLocation = (String) entry.getValue(); + } + } + if (entry.getKey().toLowerCase().contains("clientsignal")) { + if ("".equals(srcClientSignal)) { + srcClientSignal = (String) entry.getValue(); + } else if ("".equals(dstClientSignal)) { + dstClientSignal = (String) entry.getValue(); + } + } + } + + // logic for R1 uuiRequest, params in resource level + for (Object resource : resources) { + Map<String, Object> resourceObject = (Map<String, Object>) resource; + Map<String, Object> resourceParametersObject = (Map<String, Object>) resourceObject.get("parameters"); + Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject + .get("requestInputs"); + for (Entry<String, Object> entry : resourceRequestInputs.entrySet()) { + if (entry.getKey().toLowerCase().contains("location")) { + if ("".equals(srcLocation)) { + srcLocation = (String) entry.getValue(); + } else if ("".equals(dstLocation)) { + dstLocation = (String) entry.getValue(); + } + } + if (entry.getKey().toLowerCase().contains("clientsignal")) { + if ("".equals(srcClientSignal)) { + srcClientSignal = (String) entry.getValue(); + } else if ("".equals(dstClientSignal)) { + dstClientSignal = (String) entry.getValue(); + } + } + } + } + + Map<String, Object> vpnRequestInputs = getVPNResourceRequestInputs(resources); + // here we put client signal to vpn resource inputs + vpnRequestInputs.put("src-client-signal", srcClientSignal); + vpnRequestInputs.put("dst-client-signal", dstClientSignal); + + // Now we need to query terminal points from SP resourcemgr system. + List<Object> locationTerminalPointList = queryTerminalPointsFromServiceProviderSystem(srcLocation, dstLocation); + Map<String, Object> tpInfoMap = (Map<String, Object>) locationTerminalPointList.get(0); + + serviceRequestInputs.put("inner-src-access-provider-id", tpInfoMap.get("access-provider-id")); + serviceRequestInputs.put("inner-src-access-client-id", tpInfoMap.get("access-client-id")); + serviceRequestInputs.put("inner-src-access-topology-id", tpInfoMap.get("access-topology-id")); + serviceRequestInputs.put("inner-src-access-node-id", tpInfoMap.get("access-node-id")); + serviceRequestInputs.put("inner-src-access-ltp-id", tpInfoMap.get("access-ltp-id")); + tpInfoMap = (Map<String, Object>) locationTerminalPointList.get(1); + + serviceRequestInputs.put("inner-dst-access-provider-id", tpInfoMap.get("access-provider-id")); + serviceRequestInputs.put("inner-dst-access-client-id", tpInfoMap.get("access-client-id")); + serviceRequestInputs.put("inner-dst-access-topology-id", tpInfoMap.get("access-topology-id")); + serviceRequestInputs.put("inner-dst-access-node-id", tpInfoMap.get("access-node-id")); + serviceRequestInputs.put("inner-dst-access-ltp-id", tpInfoMap.get("access-ltp-id")); + + String newRequest = getJsonString(uuiObject); + return newRequest; + } + + private List<Object> queryTerminalPointsFromServiceProviderSystem(String srcLocation, String dstLocation) { + Map<String, String> locationSrc = new HashMap<>(); + locationSrc.put("location", srcLocation); + Map<String, String> locationDst = new HashMap<>(); + locationDst.put("location", dstLocation); + List<Map<String, String>> locations = new ArrayList<>(); + locations.add(locationSrc); + locations.add(locationDst); + List<Object> returnList = new ArrayList<>(); + String reqContent = getJsonString(locations); + String url = getThirdSPEndPoint(); + String responseContent = sendRequest(url, "POST", reqContent); + if (null != responseContent) { + returnList = getJsonObject(responseContent, List.class); + } + return returnList; + } + + private Map<String, Object> getVPNResourceRequestInputs(List<Object> resources) { + for (Object resource : resources) { + Map<String, Object> resourceObject = (Map<String, Object>) resource; + Map<String, Object> resourceParametersObject = (Map<String, Object>) resourceObject.get("parameters"); + Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject + .get("requestInputs"); + for (Entry<String, Object> entry : resourceRequestInputs.entrySet()) { + if (entry.getKey().toLowerCase().contains("vpntype")) { + return resourceRequestInputs; + } + } + } + return null; + } + + public static void main(String args[]){ + String str = "restconf/config/GENERIC-RESOURCE-API:services/service/eca7e542-12ba-48de-8544-fac59303b14e/service-data/networks/network/aec07806-1671-4af2-b722-53c8e320a633/network-data/"; + + int index1 = str.indexOf("/network/"); + int index2 = str.indexOf("/network-data"); + + String str1 = str.substring(index1 + "/network/".length(), index2); + System.out.println(str1); + + } + + private String doSOTNServiceHoming(ServiceDecomposition serviceDecomposition, String uuiRequest) { + // query the route for the service. + Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class); + Map<String, Object> serviceObject = (Map<String, Object>) uuiObject.get("service"); + Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject.get("parameters"); + Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject.get("requestInputs"); + Map<String, Object> oofQueryObject = new HashMap<>(); + List<Object> resources = (List<Object>) serviceParametersObject.get("resources"); + oofQueryObject.put("src-access-provider-id", serviceRequestInputs.get("inner-src-access-provider-id")); + oofQueryObject.put("src-access-client-id", serviceRequestInputs.get("inner-src-access-client-id")); + oofQueryObject.put("src-access-topology-id", serviceRequestInputs.get("inner-src-access-topology-id")); + oofQueryObject.put("src-access-node-id", serviceRequestInputs.get("inner-src-access-node-id")); + oofQueryObject.put("src-access-ltp-id", serviceRequestInputs.get("inner-src-access-ltp-id")); + oofQueryObject.put("dst-access-provider-id", serviceRequestInputs.get("inner-dst-access-provider-id")); + oofQueryObject.put("dst-access-client-id", serviceRequestInputs.get("inner-dst-access-client-id")); + oofQueryObject.put("dst-access-topology-id", serviceRequestInputs.get("inner-dst-access-topology-id")); + oofQueryObject.put("dst-access-node-id", serviceRequestInputs.get("inner-dst-access-node-id")); + oofQueryObject.put("dst-access-ltp-id", serviceRequestInputs.get("inner-dst-access-ltp-id")); + String oofRequestReq = getJsonString(oofQueryObject); + String url = getOOFCalcEndPoint(); + String responseContent = sendRequest(url, "POST", oofRequestReq); + + List<Object> returnList = new ArrayList<>(); + if (null != responseContent) { + returnList = getJsonObject(responseContent, List.class); + } + // in demo we have only one VPN. no cross VPNs, so get first item. + Map<String, Object> returnRoute = getReturnRoute(returnList); + Map<String, Object> vpnRequestInputs = getVPNResourceRequestInputs(resources); + vpnRequestInputs.putAll(returnRoute); + String newRequest = getJsonString(uuiObject); + return newRequest; + } + + private Map<String, Object> getReturnRoute(List<Object> returnList){ + Map<String, Object> returnRoute = new HashMap<>(); + for(Object returnVpn :returnList){ + Map<String, Object> returnVpnInfo = (Map<String, Object>) returnVpn; + String accessTopoId = (String)returnVpnInfo.get("access-topology-id"); + if("100".equals(accessTopoId)){ + returnRoute.putAll(returnVpnInfo); + } + else if("101".equals(accessTopoId)){ + for(String key : returnVpnInfo.keySet()){ + returnRoute.put("domain1-" + key, returnVpnInfo.get(key)); + } + } + else if("102".equals(accessTopoId)){ + for(String key : returnVpnInfo.keySet()){ + returnRoute.put("domain2-" + key, returnVpnInfo.get(key)); + } + } + else{ + for(String key : returnVpnInfo.keySet()){ + returnRoute.put("domain" + accessTopoId +"-" + key, returnVpnInfo.get(key)); + } + } + } + return returnRoute; + } + + private Map<String, Object> getResourceParams(Execution execution, String resourceCustomizationUuid, + String serviceParameters) { + List<String> resourceList = jsonUtil.StringArrayToList(execution, + (String) JsonUtils.getJsonValue(serviceParameters, "resources")); + // Get the right location str for resource. default is an empty array. + String resourceInputsFromUui = ""; + for (String resource : resourceList) { + String resCusUuid = (String) JsonUtils.getJsonValue(resource, "resourceCustomizationUuid"); + if (resourceCustomizationUuid.equals(resCusUuid)) { + String resourceParameters = JsonUtils.getJsonValue(resource, "parameters"); + resourceInputsFromUui = JsonUtils.getJsonValue(resourceParameters, "requestInputs"); + } + } + Map<String, Object> resourceInputsFromUuiMap = getJsonObject(resourceInputsFromUui, Map.class); + return resourceInputsFromUuiMap; + } + + public static <T> T getJsonObject(String jsonstr, Class<T> type) { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); + try { + return mapper.readValue(jsonstr, type); + } catch (IOException e) { + LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError, + "fail to unMarshal json", e); + } + return null; + } + + public static String getJsonString(Object srcObj) { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); + String jsonStr = null; + try { + jsonStr = mapper.writeValueAsString(srcObj); + } catch (JsonProcessingException e) { + LOGGER.debug("SdcToscaParserException", e); + e.printStackTrace(); + } + return jsonStr; + } + + private static String sendRequest(String url, String methodType, String content) { + + String msbUrl = url; + HttpRequestBase method = null; + HttpResponse httpResponse = null; + + try { + int timeout = DEFAULT_TIME_OUT; + + RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout) + .setConnectionRequestTimeout(timeout).build(); + + HttpClient client = HttpClientBuilder.create().build(); + + if ("POST".equals(methodType.toUpperCase())) { + HttpPost httpPost = new HttpPost(msbUrl); + httpPost.setConfig(requestConfig); + httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON)); + method = httpPost; + } else if ("PUT".equals(methodType.toUpperCase())) { + HttpPut httpPut = new HttpPut(msbUrl); + httpPut.setConfig(requestConfig); + httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON)); + method = httpPut; + } else if ("GET".equals(methodType.toUpperCase())) { + HttpGet httpGet = new HttpGet(msbUrl); + httpGet.setConfig(requestConfig); + method = httpGet; + } else if ("DELETE".equals(methodType.toUpperCase())) { + HttpDelete httpDelete = new HttpDelete(msbUrl); + httpDelete.setConfig(requestConfig); + method = httpDelete; + } + + // now have no auth + // String userCredentials = + // SDNCAdapterProperties.getEncryptedProperty(Constants.SDNC_AUTH_PROP, + // Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY); + // String authorization = "Basic " + + // DatatypeConverter.printBase64Binary(userCredentials.getBytes()); + // method.setHeader("Authorization", authorization); + + httpResponse = client.execute(method); + String responseContent = null; + if (null != httpResponse && httpResponse.getEntity() != null) { + try { + responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); + } catch (ParseException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != method) { + method.reset(); + } + method = null; + return responseContent; + + } catch (SocketTimeoutException | ConnectTimeoutException e) { + return null; + + } catch (Exception e) { + return null; + + } finally { + if (httpResponse != null) { + try { + EntityUtils.consume(httpResponse.getEntity()); + } catch (Exception e) { + } + } + if (method != null) { + try { + method.reset(); + } catch (Exception e) { + + } + } + } + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/META-INF/processes.xml b/bpmn/mso-infrastructure-bpmn/src/main/resources/META-INF/processes.xml new file mode 100644 index 0000000000..35235b8539 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/META-INF/processes.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ============LICENSE_START======================================================= + ONAP SO + ================================================================================ + 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========================================================= + --> + +<process-application + xmlns="http://www.camunda.org/schema/1.0/ProcessApplication" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + + <process-archive name="att-services-bpmn"> + <properties> + <property name="isDeleteUponUndeploy">false</property> + <property name="isScanForProcessDefinitions">true</property> + </properties> + </process-archive> + +</process-application> diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml new file mode 100644 index 0000000000..92e8f588a6 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml @@ -0,0 +1,275 @@ +aai: + auth: asdf + dme2: + timeout: '30000' + endpoint: http://localhost:8443 +camunda: + bpm: + admin-user: + id: admin + password: admin + history-level: full + job-execution: + max-pool-size: 30 + core-pool-size: 3 +entitymanager: + packagesToScan: com + +mso: + correlation: + timeout: 60 + logPath: logs + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + adapters: + completemsoprocess: + endpoint: http://localhost:30253/CompleteMsoProcess + db: + auth: 26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764 + password: wLg4sjrAFUS8rfVfdvTXeQ== + endpoint: http://localhost:30257/services/RequestsDbAdapter + spring: + endpoint: http://localhost:30257 + network: + endpoint: http://localhost:30253/services/NetworkAdapter + rest: + endpoint: http://localhost:30253/services/rest/v1/networks + openecomp: + db: + endpoint: http://localhost:30257/services/RequestsDbAdapter + po: + auth: 757A94191D685FD2092AC1490730A4FC + password: 3141634BF7E070AA289CF2892C986C0B + sdnc: + endpoint: http://localhost:30254/adapters/SDNCAdapter + rest: + endpoint: http://localhost:30254/adapters/rest/v1/sdnc + timeout: PT60S + tenant: + endpoint: http://localhost:30253/services/TenantAdapter + vnf: + endpoint: http://localhost:30253/services/VnfAdapter + rest: + endpoint: http://localhost:30253/services/rest/vnfs/v1/vnfs + volume-groups: + rest: + endpoint: http://localhost:30253/services/rest/v1/volume-groups + vnf-async: + endpoint: http://localhost:30253/services/VnfAdapterAsync + bpmn: + process: + historyTimeToLive: '30' + callbackRetryAttempts: '5' + catalog: + db: + endpoint: http://localhost:30258/ecomp/mso/catalog + spring: + endpoint: http://localhost:30258 + db: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + default: + adapter: + namespace: http://com.att.mso + healthcheck: + log: + debug: 'false' + infra: + customer: + id: testCustIdInfra + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + po: + timeout: PT60S + request: + db: + endpoint: http://localhost:28090/ + rollback: 'true' + sdnc: + password: 3141634BF7E070AA289CF2892C986C0B + service: + agnostic: + sniro: + endpoint: /sniro/api/v2/placement + host: http://localhost:30253 + site-name: CamundaEngine + sniro: + auth: test:testpwd + callback: http://localhost:28090/adapters/rest/SDNCNotify + endpoint: http://localhost:28090/optimizationInstance/V1/create + timeout: PT30M + workflow: + CreateGenericVNFV1: + aai: + volume-group: + uri: /aai/v6/cloud-infrastructure/volume-groups/volume-group + default: + aai: + version: '8' + cloud-region: + version: '9' + generic-vnf: + version: '9' + v11: + customer: + uri: /aai/v11/business/customers/customer + generic-query: + uri: /aai/v11/search/generic-query + generic-vnf: + uri: /aai/v11/network/generic-vnfs/generic-vnf + l3-network: + uri: /aai/v11/network/l3-networks/l3-network + network-policy: + uri: /aai/v11/network/network-policies/network-policy + nodes-query: + uri: /aai/v11/search/nodes-query + route-table-reference: + uri: /aai/v11/network/route-table-references/route-table-reference + tenant: + uri: /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant + vce: + uri: /aai/v11/network/vces/vce + vpn-binding: + uri: /aai/v11/network/vpn-bindings/vpn-binding + v8: + configuration: + uri: /aai/v11/network/configurations/configuration + customer: + uri: /aai/v8/business/customers/customer + generic-query: + uri: /aai/v8/search/generic-query + l3-network: + uri: /aai/v8/network/l3-networks/l3-network + network-policy: + uri: /aai/v8/network/network-policies/network-policy + nodes-query: + uri: /aai/v8/search/nodes-query + route-table-reference: + uri: /aai/v8/network/route-table-references/route-table-reference + tenant: + uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant + vce: + uri: /aai/v8/network/vces/vce + vpn-binding: + uri: /aai/v8/network/vpn-bindings/vpn-binding + v9: + cloud-region: + uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic + generic-vnf: + uri: /aai/v9/network/generic-vnfs/generic-vnf + retry: + attempts: '1' + deleteCinderVolumeV1: + aai: + volume-group: + uri: /aai/v6/cloud-infrastructure/volume-groups/volume-group + global: + default: + aai: + namespace: http://org.openecomp.aai.inventory/ + message: + endpoint: http://localhost:30252/mso/WorkflowMessage + notification: + name: GenericNotificationServiceATT + sdncadapter: + callback: http://localhost:30254/mso/SDNCAdapterCallbackService + vnfadapter: + create: + callback: http://localhost:30253/mso/vnfAdapterNotify + delete: + callback: http://localhost:30253/mso/vnfAdapterNotify + query: + callback: http://localhost:30253/mso/vnfAdapterNotify + rollback: + callback: http://localhost:30253/mso/vnfAdapterNotify + global: + dmaap: + username: testuser + password: alRyMzJ3NUNeakxl + host: http://localhost:3904 + publisher: + topic: com.att.mso.dev.25239-asyncStatusUpdate-v1 +policy: + auth: Basic dGVzdHBkcDphbHBoYTEyMw== + client: + auth: Basic bTAzNzQzOnBvbGljeVIwY2sk + endpoint: https://localhost:8081/pdp/api/ + environment: TEST +sdnc: + auth: Basic YWRtaW46YWRtaW4= + host: https://localhost:8443 + path: /restconf/operations/GENERIC-RESOURCE-API + +appc: + client: + topic: + read: + name: APPC-TEST-AMDOCS2 + timeout: 360000 + write: APPC-TEST-AMDOCS1-IST + response: + timeout: 360000 + key: LSl8QKolmKcC0yJR + secret: lgjXraD1HutKxv8jEN6tVouu + service: ueb + poolMembers: localhost:3904 +server: + port: 8080 + tomcat: + max-threads: 50 +spring: + h2: + console: + enabled: true + path: /h2 + datasource: + url: jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + username: sa + password: sa + driverClassName: org.h2.Driver + security: + usercredentials: + - + username: apihBpmn + password: '$2a$12$chgDUKcdlf1t41CtS/kjIOwRuq0zWdvCcYYXtyL5TqNdPW0GhN4e6' + role: BPMN-Client + - + username: sdncaBpmn + password: '$2a$12$1TeeS2hAXtqXgdL7f2jCWeF5on7/lrrVZqRmqUqYijOTfrlS2CZae' + role: BPMN-Client + - + username: poBpmn + password: '$2a$12$TixZE5fK3YkTzWcpktm.Uuk5ePFOD2n9sj2ugGRybfsz0QQ0TKLAS' + role: BPMN-Client + - + username: wmaBpmn + password: '$2a$12$WucJSJD5iUD9MuEzhfuSmeF1W/zPMbcu.384Lh8gCkB7SPtKqZQna' + role: BPMN-Client + - + username: sniro + password: '$2a$12$lbOQWS1iDmdQPxW2Mb6OiuTzGaPUrkrvoKVn2zwpFWb6n5Y86Lf1y' + role: SNIRO-Client + - + username: mso_admin + password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa' + role: ACTUATOR +request: + datasource: + url: jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + username: sa + password: sa + driver-class-name: org.h2.Driver + intialize: true + +# Hibernate +hibernate: + dialect: org.hibernate.dialect.MySQL5Dialect + show_sql: true + hbm2ddl: + auto: create + +#Actuator +management: + context-path: /manage + + diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml new file mode 100644 index 0000000000..c1f58e9db0 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml @@ -0,0 +1,30 @@ +server: + port: 8080 + tomcat: + max-threads: 50 + +spring: + datasource: + driver-class-name: org.mariadb.jdbc.Driver + url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/camundabpmn + username: ${DB_USERNAME} + password: ${DB_PASSWORD} + dbcp2: + initial-size: 5 + max-total: 20 + validation-query: select 1 + test-on-borrow: true + http: + multipart: + enabled: false + jersey: + application-path: /sobpmnengine +#Actuator +management: + context-path: /manage + metrics: + se-global-registry: false + export: + prometheus: + enabled: true # Whether exporting of metrics to Prometheus is enabled. + step: 1m # Step size (i.e. reporting frequency) to use.
\ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateActivateSDNCResource.bpmn b/bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateActivateSDNCResource.bpmn new file mode 100644 index 0000000000..29d7a11175 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateActivateSDNCResource.bpmn @@ -0,0 +1,393 @@ +<?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.10.0"> + <bpmn:process id="CreateActivateSDNCResource" name="CreateActivateSDNCResource" isExecutable="true"> + <bpmn:startEvent id="createSDNCRES_StartEvent" name="createSDNCRES_StartEvent"> + <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="createSDNCRES_StartEvent" targetRef="Task_1dlrfiw" /> + <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="Task_0tezqd4" /> + <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="prepare SDNC Create Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_18l3crb</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateActivateSDNCResource() +dcsi.prepareSDNCRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:endEvent id="EndEvent_1x6k78c" name="create SDNC call end"> + <bpmn:incoming>SequenceFlow_17md60u</bpmn:incoming> + </bpmn:endEvent> + <bpmn:callActivity id="CallActivity_1600xlj" name="Call SDNC RSRC Create Adapter V1 " calledElement="sdncAdapter"> + <bpmn:extensionElements> + <camunda:in source="CRESDNCRES_activateSDNCRequest" target="sdncAdapterWorkflowRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="sdncAdapterResponse" target="sdncAdapterResponse" /> + <camunda:out source="SDNCA_ResponseCode" target="SDNCA_ResponseCode" /> + <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_15mvedq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1xk5xed</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1xk5xed" sourceRef="CallActivity_1600xlj" targetRef="Task_0mszkkr" /> + <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred" targetRef="ScriptTask_1g5zyi6" /> + <bpmn:scriptTask id="Task_023hred" name="post SDNC create call"> + <bpmn:incoming>SequenceFlow_1afu5al</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ow44q0</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateActivateSDNCResource() +dcsi.postCreateSDNCCall(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0w2es8j" sourceRef="Task_1dlrfiw" targetRef="Task_13sx2bp" /> + <bpmn:sequenceFlow id="SequenceFlow_18l3crb" sourceRef="Task_13sx2bp" targetRef="PreprocessIncomingRequest_task" /> + <bpmn:scriptTask id="Task_1dlrfiw" name="Set the Recipe DesignTimeParam" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0w2es8j</bpmn:outgoing> + <bpmn:script><![CDATA[String recipeParamXsdDemo="""{"operationType":"VPN","apiType":"network"}""" +String recipeParamXsd="" +execution.setVariable("recipeParamXsd", recipeParamXsd)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_13sx2bp" name="Pre Process Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0w2es8j</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18l3crb</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateActivateSDNCResource() +dcsi.preProcessRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1mz0vdx" sourceRef="Task_0tezqd4" targetRef="Task_18tomkl" /> + <bpmn:sequenceFlow id="SequenceFlow_15mvedq" sourceRef="Task_18tomkl" targetRef="CallActivity_1600xlj" /> + <bpmn:scriptTask id="Task_0tezqd4" name="Create progress update parameters before create" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1mz0vdx</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateActivateSDNCResource() +dcsi.prepareUpdateBeforeCreateSDNCResource(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_0uwlr22" name="Create progress update parameters After create" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ruppyi</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1jr6zi0</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateActivateSDNCResource() +dcsi.prepareUpdateAfterCreateSDNCResource(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="Task_18tomkl" name="update progress update"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1mz0vdx</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15mvedq</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="ServiceTask_1cm8iwr" name="update progress update"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1jr6zi0</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_10cy2nu</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_1jr6zi0" sourceRef="Task_0uwlr22" targetRef="ServiceTask_1cm8iwr" /> + <bpmn:scriptTask id="ScriptTask_1g5zyi6" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_17md60u</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new CreateActivateSDNCResource() +csi.sendSyncResponse(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_17md60u" sourceRef="ScriptTask_1g5zyi6" targetRef="EndEvent_1x6k78c" /> + <bpmn:scriptTask id="ScriptTask_0a98d9a" name="prepare SDNC Activate Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_10cy2nu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0rp0tdn</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateActivateSDNCResource() +dcsi.prepareSDNCActivateRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_10cy2nu" sourceRef="ServiceTask_1cm8iwr" targetRef="ScriptTask_0a98d9a" /> + <bpmn:scriptTask id="ScriptTask_1toiss1" name="Create progress update parameters After Activate" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0s3vc50</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_05adaey</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateActivateSDNCResource() +dcsi.prepareUpdateAfterActivateSDNCResource(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_10e6vjg" name="update progress update"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_05adaey</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1afu5al</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_05adaey" sourceRef="ScriptTask_1toiss1" targetRef="ServiceTask_10e6vjg" /> + <bpmn:sequenceFlow id="SequenceFlow_1afu5al" sourceRef="ServiceTask_10e6vjg" targetRef="Task_023hred" /> + <bpmn:callActivity id="CallActivity_0pr0s2y" name="Call SDNC RSRCActivate Adapter V1 " calledElement="sdncAdapter"> + <bpmn:extensionElements> + <camunda:in source="CRESDNCRES_activateSDNCRequest" target="sdncAdapterWorkflowRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="sdncAdapterResponse" target="sdncAdapterResponse" /> + <camunda:out source="SDNCA_ResponseCode" target="SDNCA_ResponseCode" /> + <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0rp0tdn</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1efgf9m</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1efgf9m" sourceRef="CallActivity_0pr0s2y" targetRef="Task_0p200y6" /> + <bpmn:sequenceFlow id="SequenceFlow_0ruppyi" sourceRef="Task_0mszkkr" targetRef="Task_0uwlr22" /> + <bpmn:scriptTask id="Task_0mszkkr" name="post create SDNC call" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1xk5xed</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ruppyi</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateActivateSDNCResource() +dcsi.postCreateSDNC(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_0p200y6" name="post activate SDNC call" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1efgf9m</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0s3vc50</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateActivateSDNCResource() +dcsi.postActivateSDNC(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0s3vc50" sourceRef="Task_0p200y6" targetRef="ScriptTask_1toiss1" /> + <bpmn:sequenceFlow id="SequenceFlow_0rp0tdn" sourceRef="ScriptTask_0a98d9a" targetRef="CallActivity_0pr0s2y" /> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateActivateSDNCResource"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createSDNCRES_StartEvent"> + <dc:Bounds x="-111" y="111" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-134" y="147" width="85" height="28" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> + <di:waypoint xsi:type="dc:Point" x="-75" y="129" /> + <di:waypoint xsi:type="dc:Point" x="-10" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-87.5" y="108" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> + <di:waypoint xsi:type="dc:Point" x="413" y="129" /> + <di:waypoint xsi:type="dc:Point" x="460" y="129" /> + <di:waypoint xsi:type="dc:Point" x="500" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="391.5" y="108" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> + <dc:Bounds x="313" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> + <dc:Bounds x="1049" y="544" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1013" y="586" width="81" height="28" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1600xlj_di" bpmnElement="CallActivity_1600xlj"> + <dc:Bounds x="109" y="295" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1xk5xed_di" bpmnElement="SequenceFlow_1xk5xed"> + <di:waypoint xsi:type="dc:Point" x="209" y="335" /> + <di:waypoint xsi:type="dc:Point" x="257" y="335" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="188" y="314" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0"> + <di:waypoint xsi:type="dc:Point" x="896" y="562" /> + <di:waypoint xsi:type="dc:Point" x="915" y="562" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="860.5" y="541" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred"> + <dc:Bounds x="796" y="522" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0w2es8j_di" bpmnElement="SequenceFlow_0w2es8j"> + <di:waypoint xsi:type="dc:Point" x="90" y="129" /> + <di:waypoint xsi:type="dc:Point" x="148" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="74" y="108" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb"> + <di:waypoint xsi:type="dc:Point" x="248" y="129" /> + <di:waypoint xsi:type="dc:Point" x="313" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="235.5" y="108" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0lc6l7a_di" bpmnElement="Task_1dlrfiw"> + <dc:Bounds x="-10" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp"> + <dc:Bounds x="148" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1mz0vdx_di" bpmnElement="SequenceFlow_1mz0vdx"> + <di:waypoint xsi:type="dc:Point" x="606" y="129" /> + <di:waypoint xsi:type="dc:Point" x="638" y="129" /> + <di:waypoint xsi:type="dc:Point" x="638" y="129" /> + <di:waypoint xsi:type="dc:Point" x="738" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="608" y="123" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_15mvedq_di" bpmnElement="SequenceFlow_15mvedq"> + <di:waypoint xsi:type="dc:Point" x="788" y="169" /> + <di:waypoint xsi:type="dc:Point" x="788" y="218" /> + <di:waypoint xsi:type="dc:Point" x="0" y="218" /> + <di:waypoint xsi:type="dc:Point" x="0" y="335" /> + <di:waypoint xsi:type="dc:Point" x="109" y="335" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="349" y="197" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1kqf4ge_di" bpmnElement="Task_0tezqd4"> + <dc:Bounds x="506" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0hu4lhm_di" bpmnElement="Task_0uwlr22"> + <dc:Bounds x="426" y="295" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1q6ssz7_di" bpmnElement="Task_18tomkl"> + <dc:Bounds x="738" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1cm8iwr_di" bpmnElement="ServiceTask_1cm8iwr"> + <dc:Bounds x="588" y="295" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1jr6zi0_di" bpmnElement="SequenceFlow_1jr6zi0"> + <di:waypoint xsi:type="dc:Point" x="526" y="335" /> + <di:waypoint xsi:type="dc:Point" x="554" y="335" /> + <di:waypoint xsi:type="dc:Point" x="554" y="335" /> + <di:waypoint xsi:type="dc:Point" x="588" y="335" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="524" y="329" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1g5zyi6_di" bpmnElement="ScriptTask_1g5zyi6"> + <dc:Bounds x="915" y="522" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_17md60u_di" bpmnElement="SequenceFlow_17md60u"> + <di:waypoint xsi:type="dc:Point" x="1015" y="562" /> + <di:waypoint xsi:type="dc:Point" x="1049" y="562" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="987" y="540" width="90" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0a98d9a_di" bpmnElement="ScriptTask_0a98d9a"> + <dc:Bounds x="-2" y="522" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_10cy2nu_di" bpmnElement="SequenceFlow_10cy2nu"> + <di:waypoint xsi:type="dc:Point" x="638" y="375" /> + <di:waypoint xsi:type="dc:Point" x="638" y="435" /> + <di:waypoint xsi:type="dc:Point" x="-33" y="435" /> + <di:waypoint xsi:type="dc:Point" x="-33" y="562" /> + <di:waypoint xsi:type="dc:Point" x="-2" y="562" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="302.5" y="413" width="0" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1toiss1_di" bpmnElement="ScriptTask_1toiss1"> + <dc:Bounds x="490" y="522" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_10e6vjg_di" bpmnElement="ServiceTask_10e6vjg"> + <dc:Bounds x="656" y="522" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_05adaey_di" bpmnElement="SequenceFlow_05adaey"> + <di:waypoint xsi:type="dc:Point" x="590" y="562" /> + <di:waypoint xsi:type="dc:Point" x="656" y="562" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="623" y="540" width="0" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1afu5al_di" bpmnElement="SequenceFlow_1afu5al"> + <di:waypoint xsi:type="dc:Point" x="756" y="562" /> + <di:waypoint xsi:type="dc:Point" x="796" y="562" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="776" y="540" width="0" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0pr0s2y_di" bpmnElement="CallActivity_0pr0s2y"> + <dc:Bounds x="178" y="522" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1efgf9m_di" bpmnElement="SequenceFlow_1efgf9m"> + <di:waypoint xsi:type="dc:Point" x="278" y="562" /> + <di:waypoint xsi:type="dc:Point" x="336" y="562" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="307" y="540" width="0" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ruppyi_di" bpmnElement="SequenceFlow_0ruppyi"> + <di:waypoint xsi:type="dc:Point" x="357" y="335" /> + <di:waypoint xsi:type="dc:Point" x="426" y="335" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="391.5" y="313" width="0" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_13eovp4_di" bpmnElement="Task_0mszkkr"> + <dc:Bounds x="257" y="295" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0ymnxuf_di" bpmnElement="Task_0p200y6"> + <dc:Bounds x="336" y="522" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0s3vc50_di" bpmnElement="SequenceFlow_0s3vc50"> + <di:waypoint xsi:type="dc:Point" x="436" y="562" /> + <di:waypoint xsi:type="dc:Point" x="490" y="562" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="463" y="540" width="0" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0rp0tdn_di" bpmnElement="SequenceFlow_0rp0tdn"> + <di:waypoint xsi:type="dc:Point" x="98" y="562" /> + <di:waypoint xsi:type="dc:Point" x="178" y="562" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="138" y="540" width="0" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateCustom3rdONAPServiceInstance.bpmn b/bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateCustom3rdONAPServiceInstance.bpmn new file mode 100644 index 0000000000..a8bd33ca69 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateCustom3rdONAPServiceInstance.bpmn @@ -0,0 +1,389 @@ +<?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:process id="CreateCustom3rdONAPServiceInstance" name="CreateCustom3rdONAPServiceInstance" isExecutable="true"> + <bpmn:startEvent id="StartEvent_00qj6ro" name="Create SI Start Flow"> + <bpmn:outgoing>SequenceFlow_0s2spoq</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:subProcess id="SubProcess_0ka59nc" name="Sub-process for UnexpectedErrors" triggeredByEvent="true"> + <bpmn:scriptTask id="ScriptTask_0u3lw39" name="Handle Unexpected Error" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1dsbjjb</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1yay321</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.common.scripts.* ExceptionUtil ex = new ExceptionUtil() ex.processJavaException(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:startEvent id="StartEvent_0v1ffn4"> + <bpmn:outgoing>SequenceFlow_1dsbjjb</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_0eznq6x"> + <bpmn:incoming>SequenceFlow_1yay321</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1dsbjjb" name="" sourceRef="StartEvent_0v1ffn4" targetRef="ScriptTask_0u3lw39" /> + <bpmn:sequenceFlow id="SequenceFlow_1yay321" name="" sourceRef="ScriptTask_0u3lw39" targetRef="EndEvent_0eznq6x" /> + </bpmn:subProcess> + <bpmn:callActivity id="DoCreateE2EServiceInstance" name="Call DoCreateE2EServiceInstance " calledElement="DoCreateE2EServiceInstanceV3"> + <bpmn:extensionElements> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:out source="rollbackData" target="rollbackData" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceInstanceName" target="serviceInstanceName" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="productFamilyId" target="productFamilyId" /> + <camunda:in source="disableRollback" target="disableRollback" /> + <camunda:in source="serviceInputParams" target="serviceInputParams" /> + <camunda:out source="rolledBack" target="rolledBack" /> + <camunda:out source="serviceInstanceName" target="serviceInstanceName" /> + <camunda:in source="failIfExists" target="failIfExists" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> + <camunda:in sourceExpression="1610" target="sdncVersion" /> + <camunda:in source="initialStatus" target="initialStatus" /> + <camunda:in source="serviceType" target="serviceType" /> + <camunda:in source="uuiRequest" target="uuiRequest" /> + <camunda:in source="requestAction" target="operationType" /> + <camunda:in source="operationId" target="operationId" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_19eilro</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0klbpxx</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:endEvent id="EndEvent_0bpd6c0" name="End"> + <bpmn:incoming>SequenceFlow_0yayvrf</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_1s09c7d" name="Pre Process Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0s2spoq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0z4faf9</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCustomE2EServiceInstance() +csi.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_0ttvn8r" name="Prepare Completion Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_14zu6wr</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0je30si</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new CreateCustomE2EServiceInstance() +csi.prepareCompletionRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_02fyxz0" name="Call CompleteMsoProcess" calledElement="CompleteMsoProcess"> + <bpmn:extensionElements> + <camunda:in source="completionRequest" target="CompleteMsoProcessRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="CMSO_ResponseCode" target="CMSO_ResponseCode" /> + <camunda:out source="CompleteMsoProcessResponse" target="CompleteMsoProcessResponse" /> + <camunda:out source="CMSO_ErrorResponse" target="CMSO_ErrorResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0je30si</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0yayvrf</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:subProcess id="SubProcess_0vaws86" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_0dug28e"> + <bpmn:outgoing>SequenceFlow_0e1r62n</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_03wysuk"> + <bpmn:incoming>SequenceFlow_1ysapam</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_0u8o9p2" name="Prepare Fallout Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0n9pexp</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01umodj</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new CreateCustomE2EServiceInstance() +csi.prepareFalloutRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_1ang7q8" name="Call FalloutHandler" calledElement="FalloutHandler"> + <bpmn:extensionElements> + <camunda:in source="falloutRequest" target="FalloutHandlerRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="FH_ResponseCode" target="FH_ResponseCode" /> + <camunda:out source="FalloutHandlerResponse" target="FalloutHandlerResponse" /> + <camunda:out source="FH_ErrorResponse" target="FH_ErrorResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_01umodj</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ysapam</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_1rn6nqi" name="Send Error Response"> + <bpmn:incoming>SequenceFlow_0e1r62n</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0n9pexp</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new CreateCustomE2EServiceInstance() +csi.sendSyncError(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0e1r62n" sourceRef="StartEvent_0dug28e" targetRef="ScriptTask_1rn6nqi" /> + <bpmn:sequenceFlow id="SequenceFlow_1ysapam" sourceRef="CallActivity_1ang7q8" targetRef="EndEvent_03wysuk" /> + <bpmn:sequenceFlow id="SequenceFlow_0n9pexp" sourceRef="ScriptTask_1rn6nqi" targetRef="ScriptTask_0u8o9p2" /> + <bpmn:sequenceFlow id="SequenceFlow_01umodj" sourceRef="ScriptTask_0u8o9p2" targetRef="CallActivity_1ang7q8" /> + </bpmn:subProcess> + <bpmn:scriptTask id="ScriptTask_0xupxj9" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_081z8l2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_19eilro</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new CreateCustomE2EServiceInstance() +csi.sendSyncResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_0aqn64l" name="Success?"> + <bpmn:incoming>SequenceFlow_0klbpxx</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_14zu6wr</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1fueo69</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:endEvent id="EndEvent_07uk5iy"> + <bpmn:incoming>SequenceFlow_1fueo69</bpmn:incoming> + <bpmn:errorEventDefinition errorRef="Error_0nbdy47" /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0s2spoq" sourceRef="StartEvent_00qj6ro" targetRef="ScriptTask_1s09c7d" /> + <bpmn:sequenceFlow id="SequenceFlow_19eilro" sourceRef="ScriptTask_0xupxj9" targetRef="DoCreateE2EServiceInstance" /> + <bpmn:sequenceFlow id="SequenceFlow_0klbpxx" sourceRef="DoCreateE2EServiceInstance" targetRef="ExclusiveGateway_0aqn64l" /> + <bpmn:sequenceFlow id="SequenceFlow_0yayvrf" sourceRef="CallActivity_02fyxz0" targetRef="EndEvent_0bpd6c0" /> + <bpmn:sequenceFlow id="SequenceFlow_0z4faf9" sourceRef="ScriptTask_1s09c7d" targetRef="Task_1tqjch6" /> + <bpmn:sequenceFlow id="SequenceFlow_14zu6wr" name="yes" sourceRef="ExclusiveGateway_0aqn64l" targetRef="ScriptTask_0ttvn8r"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") == null}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0je30si" sourceRef="ScriptTask_0ttvn8r" targetRef="CallActivity_02fyxz0" /> + <bpmn:sequenceFlow id="SequenceFlow_1fueo69" name="no" sourceRef="ExclusiveGateway_0aqn64l" targetRef="EndEvent_07uk5iy"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") != null}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1euqjsp" sourceRef="Task_1tqjch6" targetRef="Task_19mxcw3" /> + <bpmn:scriptTask id="Task_1tqjch6" name="Init Service Operation Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0z4faf9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1euqjsp</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCustomE2EServiceInstance() +csi.prepareInitServiceOperationStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="Task_19mxcw3" name="Update Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1euqjsp</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_081z8l2</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_081z8l2" sourceRef="Task_19mxcw3" targetRef="ScriptTask_0xupxj9" /> + </bpmn:process> + <bpmn:error id="Error_0nbdy47" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateCustom3rdONAPServiceInstance"> + <bpmndi:BPMNShape id="StartEvent_00qj6ro_di" bpmnElement="StartEvent_00qj6ro"> + <dc:Bounds x="-6" y="180" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-24" y="221" width="73" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_0ka59nc_di" bpmnElement="SubProcess_0ka59nc" isExpanded="true"> + <dc:Bounds x="463" y="632" width="394" height="188" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0rhljy8_di" bpmnElement="DoCreateE2EServiceInstance"> + <dc:Bounds x="751" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0bpd6c0_di" bpmnElement="EndEvent_0bpd6c0"> + <dc:Bounds x="1258" y="286" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1268" y="322" width="22" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1s09c7d_di" bpmnElement="ScriptTask_1s09c7d"> + <dc:Bounds x="115" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0ttvn8r_di" bpmnElement="ScriptTask_0ttvn8r"> + <dc:Bounds x="1038" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_02fyxz0_di" bpmnElement="CallActivity_02fyxz0"> + <dc:Bounds x="1226" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_0vaws86_di" bpmnElement="SubProcess_0vaws86" isExpanded="true"> + <dc:Bounds x="348" y="370" width="679" height="194" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0xupxj9_di" bpmnElement="ScriptTask_0xupxj9"> + <dc:Bounds x="610" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0aqn64l_di" bpmnElement="ExclusiveGateway_0aqn64l" isMarkerVisible="true"> + <dc:Bounds x="903" y="173" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="903" y="145" width="50" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_07uk5iy_di" bpmnElement="EndEvent_07uk5iy"> + <dc:Bounds x="910" y="286" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="883" y="322" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0s2spoq_di" bpmnElement="SequenceFlow_0s2spoq"> + <di:waypoint x="30" y="198" /> + <di:waypoint x="115" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="27.5" y="177" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_19eilro_di" bpmnElement="SequenceFlow_19eilro"> + <di:waypoint x="710" y="198" /> + <di:waypoint x="751" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="685.5" y="177" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0klbpxx_di" bpmnElement="SequenceFlow_0klbpxx"> + <di:waypoint x="851" y="198" /> + <di:waypoint x="903" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="832" y="177" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0yayvrf_di" bpmnElement="SequenceFlow_0yayvrf"> + <di:waypoint x="1276" y="238" /> + <di:waypoint x="1276" y="286" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1246" y="262" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0z4faf9_di" bpmnElement="SequenceFlow_0z4faf9"> + <di:waypoint x="215" y="198" /> + <di:waypoint x="273" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="199" y="177" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_14zu6wr_di" bpmnElement="SequenceFlow_14zu6wr"> + <di:waypoint x="953" y="198" /> + <di:waypoint x="990" y="198" /> + <di:waypoint x="990" y="198" /> + <di:waypoint x="1038" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="987" y="195" width="20" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0je30si_di" bpmnElement="SequenceFlow_0je30si"> + <di:waypoint x="1138" y="198" /> + <di:waypoint x="1226" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1137" y="183" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1fueo69_di" bpmnElement="SequenceFlow_1fueo69"> + <di:waypoint x="928" y="223" /> + <di:waypoint x="928" y="250" /> + <di:waypoint x="928" y="250" /> + <di:waypoint x="928" y="286" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="901" y="228" width="15" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0u3lw39_di" bpmnElement="ScriptTask_0u3lw39"> + <dc:Bounds x="611" y="687" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0v1ffn4_di" bpmnElement="StartEvent_0v1ffn4"> + <dc:Bounds x="496" y="709" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="469" y="750" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0eznq6x_di" bpmnElement="EndEvent_0eznq6x"> + <dc:Bounds x="772" y="709" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="745" y="750" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0dug28e_di" bpmnElement="StartEvent_0dug28e"> + <dc:Bounds x="363" y="456" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="336" y="497" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_03wysuk_di" bpmnElement="EndEvent_03wysuk"> + <dc:Bounds x="942" y="456" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="915" y="497" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0u8o9p2_di" bpmnElement="ScriptTask_0u8o9p2"> + <dc:Bounds x="621" y="434" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1ang7q8_di" bpmnElement="CallActivity_1ang7q8"> + <dc:Bounds x="798" y="434" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1rn6nqi_di" bpmnElement="ScriptTask_1rn6nqi"> + <dc:Bounds x="443" y="434" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1dsbjjb_di" bpmnElement="SequenceFlow_1dsbjjb"> + <di:waypoint x="532" y="727" /> + <di:waypoint x="611" y="727" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="529.5" y="727" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1yay321_di" bpmnElement="SequenceFlow_1yay321"> + <di:waypoint x="711" y="727" /> + <di:waypoint x="772" y="727" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="701.5" y="727" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0e1r62n_di" bpmnElement="SequenceFlow_0e1r62n"> + <di:waypoint x="399" y="474" /> + <di:waypoint x="421" y="474" /> + <di:waypoint x="421" y="474" /> + <di:waypoint x="442" y="474" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="391" y="474" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ysapam_di" bpmnElement="SequenceFlow_1ysapam"> + <di:waypoint x="898" y="474" /> + <di:waypoint x="942" y="474" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="875" y="459" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0n9pexp_di" bpmnElement="SequenceFlow_0n9pexp"> + <di:waypoint x="543" y="474" /> + <di:waypoint x="570" y="474" /> + <di:waypoint x="570" y="474" /> + <di:waypoint x="621" y="474" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="540" y="474" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01umodj_di" bpmnElement="SequenceFlow_01umodj"> + <di:waypoint x="721" y="474" /> + <di:waypoint x="798" y="474" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="715.5" y="459" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1euqjsp_di" bpmnElement="SequenceFlow_1euqjsp"> + <di:waypoint x="373" y="198" /> + <di:waypoint x="446" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="364.5" y="177" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1a3vwas_di" bpmnElement="Task_1tqjch6"> + <dc:Bounds x="273" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1afiuuq_di" bpmnElement="Task_19mxcw3"> + <dc:Bounds x="446" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_081z8l2_di" bpmnElement="SequenceFlow_081z8l2"> + <di:waypoint x="546" y="198" /> + <di:waypoint x="610" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="533" y="177" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/process/DeleteCustom3rdONAPServiceInstance.bpmn b/bpmn/mso-infrastructure-bpmn/src/main/resources/process/DeleteCustom3rdONAPServiceInstance.bpmn new file mode 100644 index 0000000000..9ca0b06645 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/process/DeleteCustom3rdONAPServiceInstance.bpmn @@ -0,0 +1,381 @@ +<?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.16.2"> + <bpmn:process id="DeleteCustom3rdONAPServiceInstance" name="DeleteCustom3rdONAPServiceInstance" isExecutable="true"> + <bpmn:startEvent id="StartEvent_00m8zen" name="Delete SI Start Flow"> + <bpmn:outgoing>SequenceFlow_1wxumid</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:subProcess id="SubProcess_0amn8vu" name="Sub-process for UnexpectedErrors" triggeredByEvent="true"> + <bpmn:scriptTask id="ScriptTask_1c6ogpt" name="Handle Unexpected Error" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0guajy5</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0dbt753</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:startEvent id="StartEvent_121296y"> + <bpmn:outgoing>SequenceFlow_0guajy5</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_1dw3dwx"> + <bpmn:incoming>SequenceFlow_0dbt753</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0guajy5" name="" sourceRef="StartEvent_121296y" targetRef="ScriptTask_1c6ogpt" /> + <bpmn:sequenceFlow id="SequenceFlow_0dbt753" name="" sourceRef="ScriptTask_1c6ogpt" targetRef="EndEvent_1dw3dwx" /> + </bpmn:subProcess> + <bpmn:callActivity id="CallActivity_1vyx9hu" name="Call DoCustomDeleteE2EServiceInstance " calledElement="DoDeleteE2EServiceInstance"> + <bpmn:extensionElements> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceInstanceName" target="serviceInstanceName" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="productFamilyId" target="productFamilyId" /> + <camunda:in source="disableRollback" target="disableRollback" /> + <camunda:in source="serviceInputParams" target="serviceInputParams" /> + <camunda:in source="failIfExists" target="failIfExists" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="serviceType" target="serviceType" /> + <camunda:in sourceExpression="1610" target="sdncVersion" /> + <camunda:in source="operationId" target="operationId" /> + <camunda:in source="operationType" target="operationType" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0zf2qyk</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_07hrbs0</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:endEvent id="EndEvent_0db8bs6" name="End"> + <bpmn:incoming>SequenceFlow_1ab5l2q</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_0a63hms" name="Pre Process Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1wxumid</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0yowshs</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new DeleteCustomE2EServiceInstance() +csi.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_1fzpbop" name="Prepare Completion Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_04urx2e</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ii935p</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new DeleteCustomE2EServiceInstance() +csi.prepareCompletionRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_1wx4ihe" name="Call CompleteMsoProcess" calledElement="CompleteMsoProcess"> + <bpmn:extensionElements> + <camunda:in source="completionRequest" target="CompleteMsoProcessRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="CMSO_ResponseCode" target="CMSO_ResponseCode" /> + <camunda:out source="CompleteMsoProcessResponse" target="CompleteMsoProcessResponse" /> + <camunda:out source="CMSO_ErrorResponse" target="CMSO_ErrorResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1ii935p</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ab5l2q</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:subProcess id="SubProcess_1vbcima" name="Sub-process for FalloutHandler " triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_0jybicw"> + <bpmn:outgoing>SequenceFlow_0for83z</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_1jegbhy"> + <bpmn:incoming>SequenceFlow_0hrazlh</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_0so3xj0" name="Prepare Fallout Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1s1cbgf</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1py6yqz</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new DeleteCustomE2EServiceInstance() +csi.prepareFalloutRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_1qhekgt" name="Call FalloutHandler" calledElement="FalloutHandler"> + <bpmn:extensionElements> + <camunda:in source="falloutRequest" target="FalloutHandlerRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="FH_ResponseCode" target="FH_ResponseCode" /> + <camunda:out source="FalloutHandlerResponse" target="FalloutHandlerResponse" /> + <camunda:out source="FH_ErrorResponse" target="FH_ErrorResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1py6yqz</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0hrazlh</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_006nty7" name="Send Error Response"> + <bpmn:incoming>SequenceFlow_0for83z</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1s1cbgf</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new DeleteCustomE2EServiceInstance() +csi.sendSyncError(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0for83z" sourceRef="StartEvent_0jybicw" targetRef="ScriptTask_006nty7" /> + <bpmn:sequenceFlow id="SequenceFlow_0hrazlh" sourceRef="CallActivity_1qhekgt" targetRef="EndEvent_1jegbhy" /> + <bpmn:sequenceFlow id="SequenceFlow_1s1cbgf" sourceRef="ScriptTask_006nty7" targetRef="ScriptTask_0so3xj0" /> + <bpmn:sequenceFlow id="SequenceFlow_1py6yqz" sourceRef="ScriptTask_0so3xj0" targetRef="CallActivity_1qhekgt" /> + </bpmn:subProcess> + <bpmn:scriptTask id="ScriptTask_1mao77y" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1dkcu9o</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0zf2qyk</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new DeleteCustomE2EServiceInstance() +csi.sendSyncResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_0vu8gx6" name="Success?" default="SequenceFlow_1t6ekab"> + <bpmn:incoming>SequenceFlow_07hrbs0</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_04urx2e</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1t6ekab</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:endEvent id="EndEvent_1i1g9s6"> + <bpmn:incoming>SequenceFlow_1t6ekab</bpmn:incoming> + <bpmn:errorEventDefinition errorRef="Error_1erlsmy" /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1wxumid" sourceRef="StartEvent_00m8zen" targetRef="ScriptTask_0a63hms" /> + <bpmn:sequenceFlow id="SequenceFlow_0zf2qyk" sourceRef="ScriptTask_1mao77y" targetRef="CallActivity_1vyx9hu" /> + <bpmn:sequenceFlow id="SequenceFlow_07hrbs0" sourceRef="CallActivity_1vyx9hu" targetRef="ExclusiveGateway_0vu8gx6" /> + <bpmn:sequenceFlow id="SequenceFlow_1ab5l2q" sourceRef="CallActivity_1wx4ihe" targetRef="EndEvent_0db8bs6" /> + <bpmn:sequenceFlow id="SequenceFlow_0yowshs" sourceRef="ScriptTask_0a63hms" targetRef="Task_1jksf62" /> + <bpmn:sequenceFlow id="SequenceFlow_04urx2e" name="yes" sourceRef="ExclusiveGateway_0vu8gx6" targetRef="ScriptTask_1fzpbop"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") == null}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1ii935p" sourceRef="ScriptTask_1fzpbop" targetRef="CallActivity_1wx4ihe" /> + <bpmn:sequenceFlow id="SequenceFlow_1t6ekab" name="no" sourceRef="ExclusiveGateway_0vu8gx6" targetRef="EndEvent_1i1g9s6" /> + <bpmn:sequenceFlow id="SequenceFlow_0c4t26p" sourceRef="Task_1jksf62" targetRef="ServiceTask_0j9q5xe" /> + <bpmn:scriptTask id="Task_1jksf62" name="prepare init operation status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0yowshs</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0c4t26p</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new DeleteCustomE2EServiceInstance() +csi.prepareInitServiceOperationStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_0j9q5xe" name="Update Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0c4t26p</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1dkcu9o</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_1dkcu9o" sourceRef="ServiceTask_0j9q5xe" targetRef="ScriptTask_1mao77y" /> + </bpmn:process> + <bpmn:error id="Error_1erlsmy" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteCustom3rdONAPServiceInstance"> + <bpmndi:BPMNShape id="StartEvent_00m8zen_di" bpmnElement="StartEvent_00m8zen"> + <dc:Bounds x="490" y="209" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="471" y="250" width="74" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_0amn8vu_di" bpmnElement="SubProcess_0amn8vu" isExpanded="true"> + <dc:Bounds x="834" y="660" width="394" height="188" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1vyx9hu_di" bpmnElement="CallActivity_1vyx9hu"> + <dc:Bounds x="1121" y="187" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0db8bs6_di" bpmnElement="EndEvent_0db8bs6"> + <dc:Bounds x="1646" y="304" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1657" y="340" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0a63hms_di" bpmnElement="ScriptTask_0a63hms"> + <dc:Bounds x="562" y="187" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1fzpbop_di" bpmnElement="ScriptTask_1fzpbop"> + <dc:Bounds x="1453" y="187" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1wx4ihe_di" bpmnElement="CallActivity_1wx4ihe"> + <dc:Bounds x="1614" y="187" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_1vbcima_di" bpmnElement="SubProcess_1vbcima" isExpanded="true"> + <dc:Bounds x="736" y="374" width="679" height="194" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1mao77y_di" bpmnElement="ScriptTask_1mao77y"> + <dc:Bounds x="970" y="187" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0vu8gx6_di" bpmnElement="ExclusiveGateway_0vu8gx6" isMarkerVisible="true"> + <dc:Bounds x="1318" y="202" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1318" y="174" width="49" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1i1g9s6_di" bpmnElement="EndEvent_1i1g9s6"> + <dc:Bounds x="1325" y="304" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1298" y="340" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1wxumid_di" bpmnElement="SequenceFlow_1wxumid"> + <di:waypoint x="526" y="227" /> + <di:waypoint x="562" y="227" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="499" y="206" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0zf2qyk_di" bpmnElement="SequenceFlow_0zf2qyk"> + <di:waypoint x="1070" y="227" /> + <di:waypoint x="1121" y="227" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1050.5" y="206" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_07hrbs0_di" bpmnElement="SequenceFlow_07hrbs0"> + <di:waypoint x="1221" y="227" /> + <di:waypoint x="1318" y="227" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1225.5" y="212" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ab5l2q_di" bpmnElement="SequenceFlow_1ab5l2q"> + <di:waypoint x="1664" y="267" /> + <di:waypoint x="1664" y="304" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1634" y="279.5" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0yowshs_di" bpmnElement="SequenceFlow_0yowshs"> + <di:waypoint x="662" y="227" /> + <di:waypoint x="707" y="227" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="639.5" y="206" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_04urx2e_di" bpmnElement="SequenceFlow_04urx2e"> + <di:waypoint x="1368" y="227" /> + <di:waypoint x="1453" y="227" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1370.25" y="203" width="18" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ii935p_di" bpmnElement="SequenceFlow_1ii935p"> + <di:waypoint x="1553" y="227" /> + <di:waypoint x="1614" y="227" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1495" y="212" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1t6ekab_di" bpmnElement="SequenceFlow_1t6ekab"> + <di:waypoint x="1343" y="252" /> + <di:waypoint x="1343" y="277" /> + <di:waypoint x="1343" y="277" /> + <di:waypoint x="1343" y="304" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1352" y="277" width="12" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1c6ogpt_di" bpmnElement="ScriptTask_1c6ogpt"> + <dc:Bounds x="982" y="715" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_121296y_di" bpmnElement="StartEvent_121296y"> + <dc:Bounds x="867" y="737" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="795" y="778" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1dw3dwx_di" bpmnElement="EndEvent_1dw3dwx"> + <dc:Bounds x="1143" y="737" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1071" y="778" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0jybicw_di" bpmnElement="StartEvent_0jybicw"> + <dc:Bounds x="752" y="460" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="680" y="501" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1jegbhy_di" bpmnElement="EndEvent_1jegbhy"> + <dc:Bounds x="1331" y="460" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1259" y="501" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0so3xj0_di" bpmnElement="ScriptTask_0so3xj0"> + <dc:Bounds x="1010" y="438" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1qhekgt_di" bpmnElement="CallActivity_1qhekgt"> + <dc:Bounds x="1187" y="438" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_006nty7_di" bpmnElement="ScriptTask_006nty7"> + <dc:Bounds x="832" y="438" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0guajy5_di" bpmnElement="SequenceFlow_0guajy5"> + <di:waypoint x="903" y="755" /> + <di:waypoint x="982" y="755" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="856" y="755" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0dbt753_di" bpmnElement="SequenceFlow_0dbt753"> + <di:waypoint x="1082" y="755" /> + <di:waypoint x="1143" y="755" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1028" y="755" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0for83z_di" bpmnElement="SequenceFlow_0for83z"> + <di:waypoint x="788" y="478" /> + <di:waypoint x="810" y="478" /> + <di:waypoint x="810" y="478" /> + <di:waypoint x="831" y="478" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="735" y="478" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0hrazlh_di" bpmnElement="SequenceFlow_0hrazlh"> + <di:waypoint x="1287" y="478" /> + <di:waypoint x="1331" y="478" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1219" y="463" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1s1cbgf_di" bpmnElement="SequenceFlow_1s1cbgf"> + <di:waypoint x="932" y="478" /> + <di:waypoint x="959" y="478" /> + <di:waypoint x="959" y="478" /> + <di:waypoint x="1010" y="478" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="884" y="478" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1py6yqz_di" bpmnElement="SequenceFlow_1py6yqz"> + <di:waypoint x="1110" y="478" /> + <di:waypoint x="1187" y="478" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1060" y="463" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0c4t26p_di" bpmnElement="SequenceFlow_0c4t26p"> + <di:waypoint x="807" y="227" /> + <di:waypoint x="833" y="227" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="820" y="206" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1joo7s7_di" bpmnElement="Task_1jksf62"> + <dc:Bounds x="707" y="187" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0j9q5xe_di" bpmnElement="ServiceTask_0j9q5xe"> + <dc:Bounds x="833" y="187" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1dkcu9o_di" bpmnElement="SequenceFlow_1dkcu9o"> + <di:waypoint x="933" y="227" /> + <di:waypoint x="970" y="227" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="951.5" y="206" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn b/bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn new file mode 100644 index 0000000000..e44804a822 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn @@ -0,0 +1,162 @@ +<?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.16.2"> + <bpmn:process id="ActivateSDNCNetworkResource" name="ActivateSDNCNetworkResource" isExecutable="true"> + <bpmn:startEvent id="createNS_StartEvent" name="createNS_StartEvent"> + <bpmn:outgoing>SequenceFlow_1c92ks3</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_1x6k78c" name="create SDNC call end"> + <bpmn:incoming>SequenceFlow_17md60u</bpmn:incoming> + </bpmn:endEvent> + <bpmn:callActivity id="CallActivity_1600xlj" name="Call SDNC resource activate Adapter V1 " calledElement="sdncAdapter"> + <bpmn:extensionElements> + <camunda:in source="CRESDNCRES_activateSDNCRequest" target="sdncAdapterWorkflowRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="sdncAdapterResponse" target="CRENWKI_activateSDNCResponse" /> + <camunda:out source="SDNCA_ResponseCode" target="CRESDNCRES_sdncCreateReturnCode" /> + <camunda:out source="SDNCA_SuccessIndicator" target="CRESDNCRES_SuccessIndicator" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_18l3crb</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1xk5xed</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1xk5xed" sourceRef="CallActivity_1600xlj" targetRef="Task_0uwlr22" /> + <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred" targetRef="ScriptTask_1g5zyi6" /> + <bpmn:scriptTask id="Task_023hred" name="post SDNC activate call"> + <bpmn:incoming>SequenceFlow_1vnx1pp</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ow44q0</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new ActivateSDNCNetworkResource() +dcsi.postCreateSDNCCall(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_18l3crb" sourceRef="Task_13sx2bp" targetRef="CallActivity_1600xlj" /> + <bpmn:scriptTask id="Task_13sx2bp" name="Pre Process Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1c92ks3</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18l3crb</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new ActivateSDNCNetworkResource() +dcsi.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_0uwlr22" name="Create progress update parameters After create" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1xk5xed</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1jr6zi0</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new ActivateSDNCNetworkResource() +dcsi.prepareUpdateAfterActivateSDNCResource(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_1cm8iwr" name="update progress update"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1jr6zi0</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1vnx1pp</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_1jr6zi0" sourceRef="Task_0uwlr22" targetRef="ServiceTask_1cm8iwr" /> + <bpmn:sequenceFlow id="SequenceFlow_1vnx1pp" sourceRef="ServiceTask_1cm8iwr" targetRef="Task_023hred" /> + <bpmn:scriptTask id="ScriptTask_1g5zyi6" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_17md60u</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new ActivateSDNCNetworkResource() +csi.sendSyncResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_17md60u" sourceRef="ScriptTask_1g5zyi6" targetRef="EndEvent_1x6k78c" /> + <bpmn:sequenceFlow id="SequenceFlow_1c92ks3" sourceRef="createNS_StartEvent" targetRef="Task_13sx2bp" /> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateSDNCNetworkResource"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createNS_StartEvent"> + <dc:Bounds x="-203" y="306" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-230" y="352" width="89" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> + <dc:Bounds x="930" y="306" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="893" y="348" width="84" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1600xlj_di" bpmnElement="CallActivity_1600xlj"> + <dc:Bounds x="77" y="284" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1xk5xed_di" bpmnElement="SequenceFlow_1xk5xed"> + <di:waypoint x="177" y="324" /> + <di:waypoint x="247" y="324" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="210.5" y="314" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0"> + <di:waypoint x="694" y="324" /> + <di:waypoint x="765" y="324" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="780.5" y="314" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred"> + <dc:Bounds x="594" y="284" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb"> + <di:waypoint x="12" y="324" /> + <di:waypoint x="77" y="324" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="235.5" y="108" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp"> + <dc:Bounds x="-88" y="284" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0hu4lhm_di" bpmnElement="Task_0uwlr22"> + <dc:Bounds x="247" y="284" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1cm8iwr_di" bpmnElement="ServiceTask_1cm8iwr"> + <dc:Bounds x="417" y="284" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1jr6zi0_di" bpmnElement="SequenceFlow_1jr6zi0"> + <di:waypoint x="347" y="324" /> + <di:waypoint x="417" y="324" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="444.5" y="314" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1vnx1pp_di" bpmnElement="SequenceFlow_1vnx1pp"> + <di:waypoint x="517" y="324" /> + <di:waypoint x="594" y="324" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="641" y="314" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1g5zyi6_di" bpmnElement="ScriptTask_1g5zyi6"> + <dc:Bounds x="765" y="284" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_17md60u_di" bpmnElement="SequenceFlow_17md60u"> + <di:waypoint x="865" y="324" /> + <di:waypoint x="930" y="324" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="998" y="313" width="0" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1c92ks3_di" bpmnElement="SequenceFlow_1c92ks3"> + <di:waypoint x="-167" y="324" /> + <di:waypoint x="-88" y="324" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/DeActivateNetworkResource.bpmn b/bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/DeActivateNetworkResource.bpmn new file mode 100644 index 0000000000..31604fd689 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/DeActivateNetworkResource.bpmn @@ -0,0 +1,258 @@ +<?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.10.0"> + <bpmn:process id="DeActivateNetworkResource" name="DeActivateNetworkResource" isExecutable="true"> + <bpmn:startEvent id="deleteNetworkResource_StartEvent" name="deleteNetworkResource_StartEvent"> + <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="deleteNetworkResource_StartEvent" targetRef="Task_1dlrfiw" /> + <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="Task_0tezqd4" /> + <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="prepare SDNC Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_18l3crb</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DeleteSDNCNetworkResource() +dcsi.prepareSDNCRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:endEvent id="EndEvent_1x6k78c" name="delete SDNC call end"> + <bpmn:incoming>SequenceFlow_15wux6a</bpmn:incoming> + </bpmn:endEvent> + <bpmn:callActivity id="CallActivity_1600xlj" name="Call SDNC RSRC Adapter V1 " calledElement="sdncAdapter"> + <bpmn:extensionElements> + <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" 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" /> + <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_15mvedq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1xk5xed</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1xk5xed" sourceRef="CallActivity_1600xlj" targetRef="Task_0uwlr22" /> + <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred" targetRef="ScriptTask_1emjxm2" /> + <bpmn:scriptTask id="Task_023hred" name="post SDNC delete call"> + <bpmn:incoming>SequenceFlow_1vnx1pp</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ow44q0</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DeleteSDNCNetworkResource() +dcsi.postDeleteSDNCCall(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0w2es8j" sourceRef="Task_1dlrfiw" targetRef="Task_13sx2bp" /> + <bpmn:sequenceFlow id="SequenceFlow_18l3crb" sourceRef="Task_13sx2bp" targetRef="PreprocessIncomingRequest_task" /> + <bpmn:scriptTask id="Task_1dlrfiw" name="Set the Recipe DesignTimeParam" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0w2es8j</bpmn:outgoing> + <bpmn:script><![CDATA[String recipeParamXsdDemo="""{"operationType":"GRE"}""" +String recipeParamXsd="" +execution.setVariable("recipeParamXsd", recipeParamXsd)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_13sx2bp" name="Pre Process Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0w2es8j</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18l3crb</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DeleteSDNCNetworkResource() +dcsi.preProcessRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1mz0vdx" sourceRef="Task_0tezqd4" targetRef="Task_18tomkl" /> + <bpmn:sequenceFlow id="SequenceFlow_15mvedq" sourceRef="Task_18tomkl" targetRef="CallActivity_1600xlj" /> + <bpmn:scriptTask id="Task_0tezqd4" name="Delete progress update parameters before delete" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1mz0vdx</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DeleteSDNCNetworkResource() +dcsi.prepareUpdateBeforeDeleteSDNCResource(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_0uwlr22" name="Create progress update parameters After delete" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1xk5xed</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1jr6zi0</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DeleteSDNCNetworkResource() +dcsi.prepareUpdateAfterDeleteSDNCResource(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="Task_18tomkl" name="update progress update"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1mz0vdx</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15mvedq</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="ServiceTask_1cm8iwr" name="update progress update"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1jr6zi0</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1vnx1pp</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_1jr6zi0" sourceRef="Task_0uwlr22" targetRef="ServiceTask_1cm8iwr" /> + <bpmn:sequenceFlow id="SequenceFlow_1vnx1pp" sourceRef="ServiceTask_1cm8iwr" targetRef="Task_023hred" /> + <bpmn:scriptTask id="ScriptTask_1emjxm2" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15wux6a</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new DeleteSDNCNetworkResource() +csi.sendSyncResponse(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_15wux6a" sourceRef="ScriptTask_1emjxm2" targetRef="EndEvent_1x6k78c" /> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteSDNCNetworkResource"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="deleteNetworkResource_StartEvent"> + <dc:Bounds x="-111" y="111" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-136" y="147" width="89" height="28" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> + <di:waypoint xsi:type="dc:Point" x="-75" y="129" /> + <di:waypoint xsi:type="dc:Point" x="-10" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-87.5" y="108" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> + <di:waypoint xsi:type="dc:Point" x="413" y="129" /> + <di:waypoint xsi:type="dc:Point" x="460" y="129" /> + <di:waypoint xsi:type="dc:Point" x="500" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="391.5" y="108" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> + <dc:Bounds x="313" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> + <dc:Bounds x="967" y="317" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="933" y="359" width="79" height="28" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1600xlj_di" bpmnElement="CallActivity_1600xlj"> + <dc:Bounds x="109" y="295" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1xk5xed_di" bpmnElement="SequenceFlow_1xk5xed"> + <di:waypoint xsi:type="dc:Point" x="209" y="335" /> + <di:waypoint xsi:type="dc:Point" x="302" y="335" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="210.5" y="314" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0"> + <di:waypoint xsi:type="dc:Point" x="735" y="335" /> + <di:waypoint xsi:type="dc:Point" x="793" y="335" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="719" y="314" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred"> + <dc:Bounds x="635" y="295" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0w2es8j_di" bpmnElement="SequenceFlow_0w2es8j"> + <di:waypoint xsi:type="dc:Point" x="90" y="129" /> + <di:waypoint xsi:type="dc:Point" x="148" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="74" y="108" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb"> + <di:waypoint xsi:type="dc:Point" x="248" y="129" /> + <di:waypoint xsi:type="dc:Point" x="313" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="235.5" y="108" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0lc6l7a_di" bpmnElement="Task_1dlrfiw"> + <dc:Bounds x="-10" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp"> + <dc:Bounds x="148" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1mz0vdx_di" bpmnElement="SequenceFlow_1mz0vdx"> + <di:waypoint xsi:type="dc:Point" x="606" y="129" /> + <di:waypoint xsi:type="dc:Point" x="638" y="129" /> + <di:waypoint xsi:type="dc:Point" x="638" y="129" /> + <di:waypoint xsi:type="dc:Point" x="738" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="608" y="123" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_15mvedq_di" bpmnElement="SequenceFlow_15mvedq"> + <di:waypoint xsi:type="dc:Point" x="788" y="169" /> + <di:waypoint xsi:type="dc:Point" x="788" y="218" /> + <di:waypoint xsi:type="dc:Point" x="0" y="218" /> + <di:waypoint xsi:type="dc:Point" x="0" y="335" /> + <di:waypoint xsi:type="dc:Point" x="109" y="335" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="349" y="197" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1kqf4ge_di" bpmnElement="Task_0tezqd4"> + <dc:Bounds x="506" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0hu4lhm_di" bpmnElement="Task_0uwlr22"> + <dc:Bounds x="302" y="295" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1q6ssz7_di" bpmnElement="Task_18tomkl"> + <dc:Bounds x="738" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1cm8iwr_di" bpmnElement="ServiceTask_1cm8iwr"> + <dc:Bounds x="487" y="295" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1jr6zi0_di" bpmnElement="SequenceFlow_1jr6zi0"> + <di:waypoint xsi:type="dc:Point" x="402" y="335" /> + <di:waypoint xsi:type="dc:Point" x="487" y="335" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="444.5" y="314" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1vnx1pp_di" bpmnElement="SequenceFlow_1vnx1pp"> + <di:waypoint xsi:type="dc:Point" x="587" y="335" /> + <di:waypoint xsi:type="dc:Point" x="635" y="335" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="566" y="314" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1emjxm2_di" bpmnElement="ScriptTask_1emjxm2"> + <dc:Bounds x="793" y="295" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_15wux6a_di" bpmnElement="SequenceFlow_15wux6a"> + <di:waypoint xsi:type="dc:Point" x="893" y="335" /> + <di:waypoint xsi:type="dc:Point" x="967" y="335" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="930" y="313" width="0" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> |