diff options
9 files changed, 2147 insertions, 1 deletions
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/AaiEvent.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/AaiEvent.java new file mode 100644 index 0000000000..ceabb8a020 --- /dev/null +++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/AaiEvent.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * SO + * ================================================================================ + * Copyright (C) 2020 Samsung. 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.adapters.vevnfm.event; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class AaiEvent { + + private final boolean vserverIsClosedLoopDisabled; + private final String genericVnfVnfId; + + public AaiEvent(final boolean cld, final String id) { + this.vserverIsClosedLoopDisabled = cld; + this.genericVnfVnfId = id; + } + + @JsonProperty("vserver.is-closed-loop-disabled") + public boolean isVserverIsClosedLoopDisabled() { + return vserverIsClosedLoopDisabled; + } + + @JsonProperty("generic-vnf.vnf-id") + public String getGenericVnfVnfId() { + return genericVnfVnfId; + } +} diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/DmaapEvent.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/DmaapEvent.java new file mode 100644 index 0000000000..dc0c5502dd --- /dev/null +++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/DmaapEvent.java @@ -0,0 +1,110 @@ +/*- + * ============LICENSE_START======================================================= + * SO + * ================================================================================ + * Copyright (C) 2020 Samsung. 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.adapters.vevnfm.event; + +import static java.time.temporal.ChronoField.INSTANT_SECONDS; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Instant; +import java.util.UUID; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification; + +public class DmaapEvent { + + public static final String MSERVICE = "microservice.stringmatcher"; + public static final String ONSET = "ONSET"; + public static final String VNF = "VNF"; + public static final String VNFID = "generic-vnf.vnf-id"; + public static final String ETSI = "ETSI"; + + private final String closedLoopControlName; + private final long closedLoopAlarmStart; + private final String closedLoopEventClient; + private final String closedLoopEventStatus; + private final String requestId; + private final String targetType; + private final String target; + private final AaiEvent aaiEvent; + private final String from; + private final String version; + private final VnfLcmOperationOccurrenceNotification etsiLcmEvent; + + public DmaapEvent(final String closedLoopControlName, final String version, + final VnfLcmOperationOccurrenceNotification etsiLcmEvent) { + this.closedLoopControlName = closedLoopControlName; + this.closedLoopAlarmStart = Instant.now().getLong(INSTANT_SECONDS); + this.closedLoopEventClient = MSERVICE; + this.closedLoopEventStatus = ONSET; + this.requestId = UUID.randomUUID().toString(); + this.targetType = VNF; + this.target = VNFID; + this.aaiEvent = new AaiEvent(false, etsiLcmEvent.getId()); + this.from = ETSI; + this.version = version; + this.etsiLcmEvent = etsiLcmEvent; + } + + public String getClosedLoopControlName() { + return closedLoopControlName; + } + + public long getClosedLoopAlarmStart() { + return closedLoopAlarmStart; + } + + public String getClosedLoopEventClient() { + return closedLoopEventClient; + } + + public String getClosedLoopEventStatus() { + return closedLoopEventStatus; + } + + @JsonProperty("requestID") + public String getRequestId() { + return requestId; + } + + @JsonProperty("target_type") + public String getTargetType() { + return targetType; + } + + public String getTarget() { + return target; + } + + @JsonProperty("AAI") + public AaiEvent getAaiEvent() { + return aaiEvent; + } + + public String getFrom() { + return from; + } + + public String getVersion() { + return version; + } + + public VnfLcmOperationOccurrenceNotification getEtsiLcmEvent() { + return etsiLcmEvent; + } +} diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java index 36a4c3300d..c685ae815a 100644 --- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java +++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java @@ -1,5 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * SO + * ================================================================================ + * Copyright (C) 2020 Samsung. 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.adapters.vevnfm.service; +import org.onap.so.adapters.vevnfm.event.DmaapEvent; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification; import org.onap.so.rest.service.HttpRestServiceProvider; import org.slf4j.Logger; @@ -21,12 +42,19 @@ public class DmaapService { @Value("${dmaap.topic}") private String topic; + @Value("${dmaap.closed-loop.control.name}") + private String closedLoopControlName; + + @Value("${dmaap.version}") + private String version; + @Autowired private HttpRestServiceProvider restProvider; public void send(final VnfLcmOperationOccurrenceNotification notification) { try { - final ResponseEntity<String> response = restProvider.postHttpRequest(notification, getUrl(), String.class); + final DmaapEvent event = new DmaapEvent(closedLoopControlName, version, notification); + final ResponseEntity<String> response = restProvider.postHttpRequest(event, getUrl(), String.class); final HttpStatus statusCode = response.getStatusCode(); final String body = response.getBody(); diff --git a/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml b/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml index 72198b83c1..a2a33bfb5c 100644 --- a/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml +++ b/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml @@ -35,6 +35,10 @@ vnfm: dmaap: endpoint: http://message-router.onap:30227 topic: /events/unauthenticated.DCAE_CL_OUTPUT + closed-loop: + control: + name: ClosedLoopControlName + version: 1.0.2 spring: security: diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy new file mode 100644 index 0000000000..00b0b37b18 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy @@ -0,0 +1,429 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # + # 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.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.Relationship +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.aai.domain.yang.CommunicationServiceProfile +import org.onap.aai.domain.yang.CommunicationServiceProfiles +import org.onap.logging.filter.base.ONAPComponents +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.RequestDBUtil +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.db.request.beans.OperationStatus +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +import javax.ws.rs.NotFoundException +import javax.ws.rs.core.Response + +import static org.apache.commons.lang3.StringUtils.isBlank + +class DeleteCommunicationService extends AbstractServiceTaskProcessor { + private final String PREFIX ="DeleteCommunicationService" + private final Long TIMEOUT = 60 * 60 * 1000 + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + private RequestDBUtil requestDBUtil = new RequestDBUtil() + private static final Logger LOGGER = LoggerFactory.getLogger(DeleteCommunicationService.class) + + @Override + void preProcessRequest(DelegateExecution execution) { + execution.setVariable("prefix",PREFIX) + String msg = "" + + LOGGER.trace("Starting preProcessRequest") + + try { + // check for incoming json message/input + String siRequest = execution.getVariable("bpmnRequest") + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + execution.setVariable("operationType", "DELETE") + + //communication service id + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + msg = "communication-service id is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + LOGGER.info("Input Request: ${siRequest}, reqId: ${requestId}, serviceInstanceId: ${serviceInstanceId}") + + //requestParameters + checkAndSetRequestParam(siRequest,"globalSubscriberId",false,execution) + checkAndSetRequestParam(siRequest,"serviceType",false,execution) + checkAndSetRequestParam(siRequest,"operationId",false,execution) + + } catch (BpmnError e) { + throw e + } catch (any) { + msg = "Exception in preProcessRequest " + any.getCause() + LOGGER.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + LOGGER.trace("Exit preProcessRequest") + } + + + /** + * prepare update operation status + * @param execution + */ + void preInitUpdateOperationStatus(DelegateExecution execution){ + LOGGER.trace(" ======== STARTED initUpdateOperationStatus Process ======== ") + try{ + execution.setVariable("result","processing") + execution.setVariable("progress","0") + execution.setVariable("operationContent","delete communication service operation start") + setOperationStatus(execution) + + }catch(Exception e){ + LOGGER.error("Exception Occured Processing initUpdateOperationStatus. Exception is:\n" + e) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during initUpdateOperationStatus Method:\n" + e.getMessage()) + } + LOGGER.trace("======== COMPLETED initUpdateOperationStatus Process ======== ") + } + + /** + * send sync response + * @param execution + */ + void sendSyncResponse(DelegateExecution execution) { + LOGGER.debug("Begin sendSyncResponse") + + try { + String operationId = execution.getVariable("operationId") + String syncResponse = """{"operationId":"${operationId}"}""".trim() + sendWorkflowResponse(execution, 202, syncResponse) + + } catch (Exception ex) { + String msg = "Exception in sendSyncResponse: " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + LOGGER.debug("Exit sendSyncResponse") + } + + /** + * query CommunicationSerive from AAI + * save e2eslice-service instance id and service name + * @param execution + */ + private void queryCommunicationSeriveFromAAI(DelegateExecution execution) + { + LOGGER.trace(" ***** begin queryCommunicationSeriveFromAAI *****") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + String errorMsg = "query communication service from aai failed" + AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, serviceInstanceId, errorMsg) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + if(si.isPresent()) + { + String serviceInstName = si.get()?.getServiceInstanceName() + String e2eSliceServiceInstId + if(si.isPresent()) + { + List<Relationship> relationshipList = si.get().getRelationshipList()?.getRelationship() + for (Relationship relationship : relationshipList) + { + String relatedTo = relationship.getRelatedTo() + if (relatedTo == "service-instance") + { + String relatedLink = relationship.getRelatedLink()?:"" + e2eSliceServiceInstId = relatedLink ? relatedLink.substring(relatedLink.lastIndexOf("/") + 1,relatedLink.length()) : "" + break + } + } + } + execution.setVariable("e2eSliceServiceInstanceId", e2eSliceServiceInstId) + execution.setVariable("serviceInstanceName", serviceInstName ?: "") + LOGGER.info("communication-service Id: ${serviceInstanceId}, e2eslice-service Id: ${e2eSliceServiceInstId}, serviceName: ${serviceInstName}") + } + LOGGER.debug(" ***** Exit queryCommunicationSeriveFromAAI *****") + } + + /** + * query AAI + * @param execution + * @param aaiObjectType + * @param instanceId + * @return AAIResultWrapper + */ + private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectType aaiObjectType, String instanceId, String errorMsg) + { + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(aaiObjectType, globalSubscriberId, serviceType, instanceId) + if (!resourceClient.exists(resourceUri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMsg) + } + AAIResultWrapper wrapper = resourceClient.get(resourceUri, NotFoundException.class) + return wrapper + } + + + /** + * 再次调用deleteE2EServiceInstance接口,然后获取到operationid, + */ + void sendRequest2NSMFWF(DelegateExecution execution) { + LOGGER.trace("begin preRequestSend2NSMF") + try { + //url:/onap/so/infra/e2eServiceInstances/v3/{serviceInstanceId}" + def NSMF_endpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution) + String url = "${NSMF_endpoint}/e2eServiceInstances/v3/${execution.getVariable("e2eSliceServiceInstanceId")}" + + String requestBody = """ + { + "globalSubscriberId": "${execution.getVariable("globalSubscriberId")}", + "serviceType": "${execution.getVariable("serviceType")}" + } + """ + requestBody.replaceAll("\\s+", "") + + String basicAuthValue = UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution) + HttpClient httpClient = new HttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO) + httpClient.addAdditionalHeader("Authorization", basicAuthValue) + httpClient.addAdditionalHeader("Accept", "application/json") + Response httpResponse = httpClient.delete(requestBody) + handleNSSMFWFResponse(httpResponse, execution) + + } catch (BpmnError e) { + throw e + } catch (any) { + String msg = "Exception in DeleteCommunicationService.preRequestSend2NSMF. " + any.getCause() + LOGGER.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + LOGGER.trace("exit preRequestSend2NSMF") + } + + /** + * prepare to call sub process + * @param execution + */ + void prepareCallCheckProcessStatus(DelegateExecution execution) + { + LOGGER.debug(PREFIX + "prepareCallCheckProcessStatus Start") + + def successConditions = new ArrayList<>() + successConditions.add("finished") + execution.setVariable("successConditions", successConditions) + + def errorConditions = new ArrayList<>() + errorConditions.add("error") + execution.setVariable("errorConditions", errorConditions) + + execution.setVariable("processServiceType", "communication service") + execution.setVariable("subOperationType", "DELETE") + execution.setVariable("initProgress", 20) + execution.setVariable("endProgress",90) + + execution.setVariable("timeOut", TIMEOUT) + + LOGGER.debug(PREFIX + "prepareCallCheckProcessStatus Exit") + } + + /** + * delete communication profile from AAI + * @param execution + */ + void delCSProfileFromAAI(DelegateExecution execution) + { + LOGGER.debug("start delete communication service profile from AAI") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + String profileId + try + { + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_PROFILE_ALL, globalSubscriberId, serviceType, serviceInstanceId) + AAIResultWrapper wrapper = resourceClient.get(resourceUri, NotFoundException.class) + Optional<CommunicationServiceProfiles> csProfilesOpt = wrapper.asBean(CommunicationServiceProfiles.class) + if(csProfilesOpt.isPresent()){ + CommunicationServiceProfiles csProf + iles = csProfilesOpt.get() + CommunicationServiceProfile csProfile = csProfiles.getCommunicationServiceProfile().get(0) + profileId = csProfile ? csProfile.getProfileId() : "" + } + resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_SERVICE_PROFILE, globalSubscriberId, serviceType, serviceInstanceId, profileId) + if (!resourceClient.exists(resourceUri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "communication service profile was not found in aai") + } + + resourceClient.delete(resourceUri) + LOGGER.debug("end delete communication service profile from AAI") + } + catch (any) + { + String msg = "delete communication service profile from aai failed! cause-"+any.getCause() + LOGGER.error(any.printStackTrace()) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } + + } + + /** + * delete communication service from AAI + * @param execution + */ + void delCSFromAAI(DelegateExecution execution) + { + try + { + LOGGER.debug("start delete communication service from AAI") + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), execution.getVariable("serviceInstanceId")) + resourceClient.delete(serviceInstanceUri) + + execution.setVariable("progress", "100") + execution.setVariable("result", "finished") + execution.setVariable("operationContent", "CSMF completes service terminated.") + setOperationStatus(execution) + LOGGER.debug("end delete communication service from AAI") + } + catch (any) + { + LOGGER.error("Error occured within delCSFromAAI method, cause: ${any.getCause()} ") + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during delete communication service from aai") + } + } + + void sendSyncError(DelegateExecution execution) + { + LOGGER.debug("Starting sendSyncError") + + try { + String errorMessage + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> + <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException>""" + + LOGGER.debug(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + LOGGER.error("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + } + + /** + * prepare update operation status + * @param execution + */ + void preFailedOperationStatus(DelegateExecution execution) + { + LOGGER.debug(" ======== STARTED preFailedOperationStatus Process ======== ") + + execution.setVariable("progress", "100") + execution.setVariable("result", "error") + execution.setVariable("operationContent", "terminate service failure") + + WorkflowException wfex = execution.getVariable("WorkflowException") as WorkflowException + String errorMessage = wfex.getErrorMessage() + errorMessage = errorMessage.length() > 200 ? errorMessage.substring(0,200) + "......" : errorMessage + execution.setVariable("reason", errorMessage) + setOperationStatus(execution) + + LOGGER.debug("======== COMPLETED prepareEndOperationStatus Process ======== ") + } + + /** + * prepare Operation status + * @param execution + * @param operationType + */ + private void setOperationStatus(DelegateExecution execution) + { + OperationStatus operationStatus = new OperationStatus() + operationStatus.setServiceId(execution.getVariable("serviceInstanceId")) + operationStatus.setOperationId(execution.getVariable("operationId")) + operationStatus.setUserId(execution.getVariable("globalSubscriberId")) + //interface not support update + operationStatus.setServiceName(execution.getVariable("serviceInstanceName")) + operationStatus.setResult(execution.getVariable("result")) + operationStatus.setProgress(execution.getVariable("progress")) + operationStatus.setOperationContent(execution.getVariable("operationContent")) + operationStatus.setReason(execution.getVariable("reason")?:"") + operationStatus.setOperation("DELETE") + + requestDBUtil.prepareUpdateOperationStatus(execution, operationStatus) + } + + void prepareFailureStatus(DelegateExecution execution) + { + execution.setVariable("progress", "100") + execution.setVariable("operationContent", "terminate service failure.") + setOperationStatus(execution) + LOGGER.debug("${PREFIX}-prepareFailureStatus,result:${execution.getVariable("result")}, reason: ${execution.getVariable("reason")}") + } + + /** + * check request json and save parameter to execution + * @param siRequest + * @param paraName + * @param isErrorException + * @param execution + */ + private void checkAndSetRequestParam(String siRequest, String paraName, boolean isErrorException, DelegateExecution execution) + { + String msg = "" + String paramValue = jsonUtil.getJsonValue(siRequest, paraName) + if (isBlank(paramValue)) { + msg = "Input ${paraName} is null" + LOGGER.error(msg) + if(isErrorException) + { + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + } else { + execution.setVariable(paraName, paramValue) + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy new file mode 100644 index 0000000000..f0d43cf8d7 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy @@ -0,0 +1,263 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (c) 2019, CMCC Technologies Co., Ltd. + * ================================================================================ + * 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.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.ServiceProfile +import org.onap.aai.domain.yang.ServiceProfiles +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.RequestDBUtil +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.db.request.beans.OperationStatus +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +import javax.ws.rs.NotFoundException + +import static org.apache.commons.lang3.StringUtils.isBlank + +class DeleteSliceService extends AbstractServiceTaskProcessor { + + String Prefix="DELSS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + private RequestDBUtil requestDBUtil = new RequestDBUtil() + + private static final Logger logger = LoggerFactory.getLogger( DeleteSliceService.class) + + @Override + void preProcessRequest(DelegateExecution execution) { + execution.setVariable("prefix", Prefix) + String msg = "" + + logger.trace("Starting preProcessRequest") + + try { + // check for incoming json message/input + String siRequest = execution.getVariable("bpmnRequest") + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + + //e2eslice-service instance id + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + msg = "e2eslice-service id is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + logger.info("Input Request: ${siRequest}, reqId: ${requestId}, e2eslice-service: ${serviceInstanceId}") + + //subscriberInfo + checkAndSetRequestParam(siRequest,"globalSubscriberId",false, execution) + checkAndSetRequestParam(siRequest,"serviceType",false, execution) + checkAndSetRequestParam(siRequest,"operationId",false, execution) + + //prepare init operation status + execution.setVariable("progress", "0") + execution.setVariable("result", "processing") + execution.setVariable("operationType", "DELETE") + execution.setVariable("operationContent", "Prepare init service") + updateServiceOperationStatus(execution) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in preProcessRequest " + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.trace("Exit preProcessRequest") + } + + /** + * send asynchronous response + * @param execution + */ + void sendAsyncResponse(DelegateExecution execution) { + logger.trace("Staring sendSyncResponse") + + try { + String operationId = execution.getVariable("operationId") + String syncResponse = """{"operationId":"${operationId}"}""".trim() + logger.info("sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) + sendWorkflowResponse(execution, 202, syncResponse) + + } catch (Exception ex) { + String msg = "Exception in sendSyncResponse: " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.trace("Exit sendSyncResponse") + } + + /** + * Deletes the slice service instance in aai + */ + void deleteSliceServiceInstance(DelegateExecution execution) { + logger.trace("Entered deleteSliceServiceInstance") + try { + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), execution.getVariable("serviceInstanceId")) + resourceClient.delete(serviceInstanceUri) + + execution.setVariable("progress", "100") + execution.setVariable("result", "finished") + execution.setVariable("operationContent", "NSMF completes slicing service termination.") + updateServiceOperationStatus(execution) + + logger.trace("Exited deleteSliceServiceInstance") + }catch(Exception e){ + logger.debug("Error occured within deleteSliceServiceInstance method: " + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during deleteSliceServiceInstance from aai") + } + } + + /** + * update operation status + * @param execution + */ + private void updateServiceOperationStatus(DelegateExecution execution){ + + OperationStatus operationStatus = new OperationStatus() + operationStatus.setServiceId(execution.getVariable("serviceInstanceId")) + operationStatus.setOperationId(execution.getVariable("operationId")) + operationStatus.setUserId(execution.getVariable("globalSubscriberId")) + operationStatus.setResult(execution.getVariable("result")) + operationStatus.setProgress(execution.getVariable("progress")) + operationStatus.setOperationContent(execution.getVariable("operationContent")) + operationStatus.setReason(execution.getVariable("reason")) + operationStatus.setOperation(execution.getVariable("operationType")) + + requestDBUtil.prepareUpdateOperationStatus(execution, operationStatus) + } + + /** + * delete service profile from aai + * @param execution + */ + private void delServiceProfileFromAAI(DelegateExecution execution) + { + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String profileId = "" + + try + { + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE_ALL, globalSubscriberId, serviceType, serviceInstanceId) + AAIResultWrapper wrapper = resourceClient.get(resourceUri, NotFoundException.class) + Optional<ServiceProfiles> serviceProfilesOpt =wrapper.asBean(ServiceProfiles.class) + if(serviceProfilesOpt.isPresent()){ + ServiceProfiles serviceProfiles = serviceProfilesOpt.get() + ServiceProfile serviceProfile = serviceProfiles.getServiceProfile().get(0) + profileId = serviceProfile ? serviceProfile.getProfileId() : "" + } + resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE, globalSubscriberId, serviceType, serviceInstanceId, profileId) + if (!resourceClient.exists(resourceUri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") + } + resourceClient.delete(resourceUri) + } + catch (any) + { + String msg = "delete service profile from aai failed! cause-"+any.getCause() + logger.error(any.printStackTrace()) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } + } + + void sendSyncError(DelegateExecution execution) { + logger.info("Starting sendSyncError") + + try { + String errorMessage + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> + <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException>""" + + logger.debug(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + logger.error("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + + } + + void prepareEndOperationStatus(DelegateExecution execution){ + logger.debug(" ======== STARTED prepareEndOperationStatus Process ======== ") + + execution.setVariable("progress", "100") + execution.setVariable("result", "error") + execution.setVariable("operationContent", "NSSMF Terminate service failure") + + WorkflowException wfex = execution.getVariable("WorkflowException") as WorkflowException + String errorMessage = wfex.getErrorMessage() + errorMessage = errorMessage.length() > 200 ? errorMessage.substring(0,200) + "......" : errorMessage + execution.setVariable("reason",errorMessage) + updateServiceOperationStatus(execution) + + logger.debug("======== COMPLETED prepareEndOperationStatus Process ======== ") + } + + /** + * check parameters from request body + * set to execution + * @param siRequest + * @param paraName + * @param isErrorException + * @param execution + */ + private void checkAndSetRequestParam(String siRequest, String paraName, boolean isErrorException, DelegateExecution execution) + { + String msg = "" + String paramValue = jsonUtil.getJsonValue(siRequest, paraName) + if (isBlank(paramValue)) { + msg = "Input ${paraName} is null" + logger.error(msg) + if(isErrorException) + { + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + } else { + execution.setVariable(paraName, paramValue) + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCommunicationService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCommunicationService.bpmn new file mode 100644 index 0000000000..58a69621d3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCommunicationService.bpmn @@ -0,0 +1,523 @@ +<?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:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1nvjixd" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> + <bpmn:process id="DeleteCommunicationService" name="DeleteCommunicationService" isExecutable="true"> + <bpmn:startEvent id="StartEvent_1" name="start"> + <bpmn:outgoing>SequenceFlow_1kjqnil</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_1kjqnil" sourceRef="StartEvent_1" targetRef="Task_1mqm4nb" /> + <bpmn:sequenceFlow id="SequenceFlow_0ogievs" sourceRef="Task_1mqm4nb" targetRef="Task_0q2v7qe" /> + <bpmn:sequenceFlow id="SequenceFlow_192yyii" sourceRef="Task_0q2v7qe" targetRef="Task_0zaekmn" /> + <bpmn:serviceTask id="Task_0zaekmn" name="Init Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_192yyii</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0xvoume</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:scriptTask id="Task_0q2v7qe" name="Init Service Operation Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ogievs</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_192yyii</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs= new DeleteCommunicationService() +dcs.preInitUpdateOperationStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_1mqm4nb" name="PreProcessRequest" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1kjqnil</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ogievs</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs= new DeleteCommunicationService() +dcs.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_1k5stey" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0xvoume</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_017qgen</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs = new DeleteCommunicationService() +dcs.sendSyncResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0xvoume" sourceRef="Task_0zaekmn" targetRef="ScriptTask_1k5stey" /> + <bpmn:sequenceFlow id="SequenceFlow_017qgen" sourceRef="ScriptTask_1k5stey" targetRef="Task_0ux5uk1" /> + <bpmn:serviceTask id="Task_1kizznk" name="Update Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0jrbkau</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ssiyug</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="Task_0xwjycr" name="update operation status completed"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/json</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_00g94pg</bpmn:incoming> + <bpmn:incoming>SequenceFlow_16ewagx</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1amyd7h</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_10g2pnj</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:endEvent id="EndEvent_0ixagvk" name="end"> + <bpmn:incoming>SequenceFlow_10g2pnj</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_10g2pnj" sourceRef="Task_0xwjycr" targetRef="EndEvent_0ixagvk" /> + <bpmn:scriptTask id="Task_0ux5uk1" name="Query CommunicationSerive From AAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_017qgen</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1j0e2po</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs = new DeleteCommunicationService() +dcs.queryCommunicationSeriveFromAAI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0ce724z" name="Go to Query delete progress"> + <bpmn:incoming>SequenceFlow_0bmtfxq</bpmn:incoming> + <bpmn:linkEventDefinition name="QueryDeleteProgress" /> + </bpmn:intermediateThrowEvent> + <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_11i33ob" name="QueryDeleteProgress"> + <bpmn:outgoing>SequenceFlow_1tcgzv0</bpmn:outgoing> + <bpmn:linkEventDefinition name="QueryDeleteProgress" /> + </bpmn:intermediateCatchEvent> + <bpmn:scriptTask id="Task_0qg5gn6" name="send request to NSMF WF" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_12xn3kz</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0bmtfxq</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs = new DeleteCommunicationService() +dcs.sendRequest2NSMFWF(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0bmtfxq" sourceRef="Task_0qg5gn6" targetRef="IntermediateThrowEvent_0ce724z" /> + <bpmn:scriptTask id="Task_0qvxmnh" name="Delete CS Profile From AAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0s7s7zk</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0arvpzv</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs = new DeleteCommunicationService() +dcs.delCSProfileFromAAI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0arvpzv" sourceRef="Task_0qvxmnh" targetRef="Task_0b5j6rg" /> + <bpmn:scriptTask id="Task_0b5j6rg" name="Delete CS From AAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0arvpzv</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_00g94pg</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs = new DeleteCommunicationService() +dcs.delCSFromAAI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:subProcess id="SubProcess_0p6namq" name="Exception Handling Sub-Process" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_1843894"> + <bpmn:outgoing>SequenceFlow_1u5ko4h</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_1u5ko4h" sourceRef="StartEvent_1843894" targetRef="Task_1spbb2x" /> + <bpmn:scriptTask id="Task_1spbb2x" name="Send Error Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1u5ko4h</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_05yfw7t</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs = new DeleteCommunicationService() +dcs.sendSyncError(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_05yfw7t" sourceRef="Task_1spbb2x" targetRef="Task_0yqtfvh" /> + <bpmn:scriptTask id="Task_0yqtfvh" name="Pre update Failed Operation Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_05yfw7t</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0c0btia</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs = new DeleteCommunicationService() +dcs.preFailedOperationStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0c0btia" sourceRef="Task_0yqtfvh" targetRef="Task_1s3l3fc" /> + <bpmn:serviceTask id="Task_1s3l3fc" name="Update Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0c0btia</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1w55zo7</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:endEvent id="EndEvent_1fsful5"> + <bpmn:incoming>SequenceFlow_1w55zo7</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1w55zo7" sourceRef="Task_1s3l3fc" targetRef="EndEvent_1fsful5" /> + </bpmn:subProcess> + <bpmn:sequenceFlow id="SequenceFlow_1tcgzv0" sourceRef="IntermediateThrowEvent_11i33ob" targetRef="ExclusiveGateway_16tdrty" /> + <bpmn:subProcess id="SubProcess_1l7gd5k" name="Sub-process for UnexpectedErrors" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_0zc2hnn"> + <bpmn:outgoing>SequenceFlow_0mifi3x</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_0mifi3x" sourceRef="StartEvent_0zc2hnn" targetRef="Task_01va9ms" /> + <bpmn:endEvent id="EndEvent_052gdjz"> + <bpmn:incoming>SequenceFlow_073yxs4</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_073yxs4" sourceRef="Task_01va9ms" targetRef="EndEvent_052gdjz" /> + <bpmn:scriptTask id="Task_01va9ms" name="Handle Unexpected Error" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0mifi3x</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_073yxs4</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)</bpmn:script> + </bpmn:scriptTask> + </bpmn:subProcess> + <bpmn:exclusiveGateway id="ExclusiveGateway_1lyw619" name="Is NSMF timeout?" default="SequenceFlow_0s7s7zk"> + <bpmn:incoming>SequenceFlow_0xipbpr</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1sah9so</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0s7s7zk</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0bqfbxf</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0s7s7zk" sourceRef="ExclusiveGateway_1lyw619" targetRef="Task_0qvxmnh" /> + <bpmn:sequenceFlow id="SequenceFlow_00g94pg" sourceRef="Task_0b5j6rg" targetRef="Task_0xwjycr" /> + <bpmn:sequenceFlow id="SequenceFlow_0bqfbxf" name="yes" sourceRef="ExclusiveGateway_1lyw619" targetRef="Task_1ovewjr"> + <bpmn:documentation>#{(execution.getVariable("isTimeOut") == "YES")}</bpmn:documentation> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isTimeOut") == "YES")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:exclusiveGateway id="ExclusiveGateway_16tdrty" name="is NSMF Async Succeed?" default="SequenceFlow_0jrbkau"> + <bpmn:incoming>SequenceFlow_1tcgzv0</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0jrbkau</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_16ewagx</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0jrbkau" sourceRef="ExclusiveGateway_16tdrty" targetRef="Task_1kizznk" /> + <bpmn:sequenceFlow id="SequenceFlow_16ewagx" name="no" sourceRef="ExclusiveGateway_16tdrty" targetRef="Task_0xwjycr"> + <bpmn:documentation>#{(execution.getVariable("isNSMFWFRspSucceed" ) == "no")}</bpmn:documentation> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSMFWFRspSucceed" ) == "no")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:exclusiveGateway id="ExclusiveGateway_0icj4go" name="Is E2E Slice Service Instance Id Exist?" default="SequenceFlow_12xn3kz"> + <bpmn:incoming>SequenceFlow_1j0e2po</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_12xn3kz</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0xipbpr</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1j0e2po" sourceRef="Task_0ux5uk1" targetRef="ExclusiveGateway_0icj4go" /> + <bpmn:sequenceFlow id="SequenceFlow_12xn3kz" sourceRef="ExclusiveGateway_0icj4go" targetRef="Task_0qg5gn6" /> + <bpmn:sequenceFlow id="SequenceFlow_0xipbpr" name="no" sourceRef="ExclusiveGateway_0icj4go" targetRef="ExclusiveGateway_1lyw619"> + <bpmn:documentation>#{(execution.getVariable("e2eSliceServiceInstanceId") == null)}</bpmn:documentation> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("e2eSliceServiceInstanceId") == null)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:callActivity id="Task_1ff6flk" name="CallCheckServiceProcessStatus" calledElement="CheckServiceProcessStatus"> + <bpmn:extensionElements> + <camunda:in source="e2eSliceServiceInstanceId" target="serviceInstanceId" /> + <camunda:in source="e2eOperationId" target="operationId" /> + <camunda:in source="successConditions" target="successConditions" /> + <camunda:in source="errorConditions" target="errorConditions" /> + <camunda:in source="processServiceType" target="processServiceType" /> + <camunda:in source="timeOut" target="timeOut" /> + <camunda:out source="operationStatus" target="result" /> + <camunda:out source="operationContent" target="reason" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:out source="isTimeOut" target="isTimeOut" /> + <camunda:in source="subOperationType" target="operationType" /> + <camunda:in source="initProgress" target="initProgress" /> + <camunda:in source="endProgress" target="endProgress" /> + <camunda:in source="serviceInstanceId" target="parentServiceInstanceId" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="operationId" target="parentOperationId" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0thr8dc</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1sah9so</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="Task_1ovewjr" name="Prepare update operation status error" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0bqfbxf</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1amyd7h</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs = new DeleteCommunicationService() +dcs.prepareFailureStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1amyd7h" sourceRef="Task_1ovewjr" targetRef="Task_0xwjycr" /> + <bpmn:sequenceFlow id="SequenceFlow_1sah9so" sourceRef="Task_1ff6flk" targetRef="ExclusiveGateway_1lyw619" /> + <bpmn:sequenceFlow id="SequenceFlow_1ssiyug" sourceRef="Task_1kizznk" targetRef="Task_0y1n9ls" /> + <bpmn:sequenceFlow id="SequenceFlow_0thr8dc" sourceRef="Task_0y1n9ls" targetRef="Task_1ff6flk" /> + <bpmn:scriptTask id="Task_0y1n9ls" name="Prepare Call CheckServiceProcessStatus" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1ssiyug</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0thr8dc</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs = new DeleteCommunicationService() +dcs.prepareCallCheckProcessStatus(execution)</bpmn:script> + </bpmn:scriptTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteCommunicationService"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="152" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="159" y="145" width="23" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1kjqnil_di" bpmnElement="SequenceFlow_1kjqnil"> + <di:waypoint x="188" y="120" /> + <di:waypoint x="240" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ogievs_di" bpmnElement="SequenceFlow_0ogievs"> + <di:waypoint x="340" y="120" /> + <di:waypoint x="390" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_192yyii_di" bpmnElement="SequenceFlow_192yyii"> + <di:waypoint x="490" y="120" /> + <di:waypoint x="560" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_104igd7_di" bpmnElement="Task_0zaekmn"> + <dc:Bounds x="560" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0tqibrd_di" bpmnElement="Task_0q2v7qe"> + <dc:Bounds x="390" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_18pflck_di" bpmnElement="Task_1mqm4nb"> + <dc:Bounds x="240" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1k5stey_di" bpmnElement="ScriptTask_1k5stey"> + <dc:Bounds x="740" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0xvoume_di" bpmnElement="SequenceFlow_0xvoume"> + <di:waypoint x="660" y="120" /> + <di:waypoint x="740" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_017qgen_di" bpmnElement="SequenceFlow_017qgen"> + <di:waypoint x="840" y="120" /> + <di:waypoint x="910" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_17pxrcl_di" bpmnElement="Task_1kizznk"> + <dc:Bounds x="330" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0ucwm85_di" bpmnElement="Task_0xwjycr"> + <dc:Bounds x="1250" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0ixagvk_di" bpmnElement="EndEvent_0ixagvk"> + <dc:Bounds x="1432" y="332" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1441" y="375" width="19" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_10g2pnj_di" bpmnElement="SequenceFlow_10g2pnj"> + <di:waypoint x="1350" y="350" /> + <di:waypoint x="1432" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_05zxl7j_di" bpmnElement="Task_0ux5uk1"> + <dc:Bounds x="910" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1go0jt1_di" bpmnElement="IntermediateThrowEvent_0ce724z"> + <dc:Bounds x="1432" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1417" y="145" width="76" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateCatchEvent_09w3u1d_di" bpmnElement="IntermediateThrowEvent_11i33ob"> + <dc:Bounds x="152" y="332" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="127" y="375" width="86" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0me3crz_di" bpmnElement="Task_0qg5gn6"> + <dc:Bounds x="1220" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0bmtfxq_di" bpmnElement="SequenceFlow_0bmtfxq"> + <di:waypoint x="1320" y="120" /> + <di:waypoint x="1432" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_14svlaf_di" bpmnElement="Task_0qvxmnh"> + <dc:Bounds x="900" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0arvpzv_di" bpmnElement="SequenceFlow_0arvpzv"> + <di:waypoint x="1000" y="350" /> + <di:waypoint x="1060" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0q6s59r_di" bpmnElement="Task_0b5j6rg"> + <dc:Bounds x="1060" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_04znyto_di" bpmnElement="SubProcess_0p6namq" isExpanded="true"> + <dc:Bounds x="480" y="650" width="730" height="210" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1qti4dg_di" bpmnElement="StartEvent_1843894"> + <dc:Bounds x="520" y="742" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1u5ko4h_di" bpmnElement="SequenceFlow_1u5ko4h"> + <di:waypoint x="556" y="760" /> + <di:waypoint x="610" y="760" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0xdbw5d_di" bpmnElement="Task_1spbb2x"> + <dc:Bounds x="610" y="720" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_05yfw7t_di" bpmnElement="SequenceFlow_05yfw7t"> + <di:waypoint x="710" y="760" /> + <di:waypoint x="770" y="760" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0hmczex_di" bpmnElement="Task_0yqtfvh"> + <dc:Bounds x="770" y="720" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0c0btia_di" bpmnElement="SequenceFlow_0c0btia"> + <di:waypoint x="870" y="760" /> + <di:waypoint x="930" y="760" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0ra7dbt_di" bpmnElement="Task_1s3l3fc"> + <dc:Bounds x="930" y="720" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1fsful5_di" bpmnElement="EndEvent_1fsful5"> + <dc:Bounds x="1092" y="742" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1w55zo7_di" bpmnElement="SequenceFlow_1w55zo7"> + <di:waypoint x="1030" y="760" /> + <di:waypoint x="1092" y="760" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1tcgzv0_di" bpmnElement="SequenceFlow_1tcgzv0"> + <di:waypoint x="188" y="350" /> + <di:waypoint x="235" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_0dwywjh_di" bpmnElement="SubProcess_1l7gd5k" isExpanded="true"> + <dc:Bounds x="660" y="950" width="350" height="200" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_18u3hph_di" bpmnElement="StartEvent_0zc2hnn"> + <dc:Bounds x="700" y="1032" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0mifi3x_di" bpmnElement="SequenceFlow_0mifi3x"> + <di:waypoint x="736" y="1050" /> + <di:waypoint x="790" y="1050" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_052gdjz_di" bpmnElement="EndEvent_052gdjz"> + <dc:Bounds x="952" y="1032" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_073yxs4_di" bpmnElement="SequenceFlow_073yxs4"> + <di:waypoint x="890" y="1050" /> + <di:waypoint x="952" y="1050" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0lzly9f_di" bpmnElement="Task_01va9ms"> + <dc:Bounds x="790" y="1010" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1lyw619_di" bpmnElement="ExclusiveGateway_1lyw619" isMarkerVisible="true"> + <dc:Bounds x="785" y="325" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="786.5" y="384.5" width="47" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0s7s7zk_di" bpmnElement="SequenceFlow_0s7s7zk"> + <di:waypoint x="835" y="350" /> + <di:waypoint x="900" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_00g94pg_di" bpmnElement="SequenceFlow_00g94pg"> + <di:waypoint x="1160" y="350" /> + <di:waypoint x="1250" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0bqfbxf_di" bpmnElement="SequenceFlow_0bqfbxf"> + <di:waypoint x="810" y="325" /> + <di:waypoint x="810" y="250" /> + <di:waypoint x="900" y="250" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="846" y="232" width="17" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_16tdrty_di" bpmnElement="ExclusiveGateway_16tdrty" isMarkerVisible="true"> + <dc:Bounds x="235" y="325" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="226" y="295" width="77" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0jrbkau_di" bpmnElement="SequenceFlow_0jrbkau"> + <di:waypoint x="285" y="350" /> + <di:waypoint x="330" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_16ewagx_di" bpmnElement="SequenceFlow_16ewagx"> + <di:waypoint x="260" y="375" /> + <di:waypoint x="260" y="500" /> + <di:waypoint x="1300" y="500" /> + <di:waypoint x="1300" y="390" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="774" y="482" width="13" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_0icj4go_di" bpmnElement="ExclusiveGateway_0icj4go" isMarkerVisible="true"> + <dc:Bounds x="1085" y="95" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1069" y="50" width="82" height="40" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1j0e2po_di" bpmnElement="SequenceFlow_1j0e2po"> + <di:waypoint x="1010" y="120" /> + <di:waypoint x="1085" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_12xn3kz_di" bpmnElement="SequenceFlow_12xn3kz"> + <di:waypoint x="1135" y="120" /> + <di:waypoint x="1220" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0xipbpr_di" bpmnElement="SequenceFlow_0xipbpr"> + <di:waypoint x="1110" y="145" /> + <di:waypoint x="1110" y="190" /> + <di:waypoint x="810" y="190" /> + <di:waypoint x="810" y="325" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="946" y="172" width="13" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1knnc2k_di" bpmnElement="Task_1ff6flk"> + <dc:Bounds x="630" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1r84j75_di" bpmnElement="Task_1ovewjr"> + <dc:Bounds x="900" y="210" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1amyd7h_di" bpmnElement="SequenceFlow_1amyd7h"> + <di:waypoint x="1000" y="250" /> + <di:waypoint x="1300" y="250" /> + <di:waypoint x="1300" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1sah9so_di" bpmnElement="SequenceFlow_1sah9so"> + <di:waypoint x="730" y="350" /> + <di:waypoint x="785" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ssiyug_di" bpmnElement="SequenceFlow_1ssiyug"> + <di:waypoint x="430" y="350" /> + <di:waypoint x="480" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0thr8dc_di" bpmnElement="SequenceFlow_0thr8dc"> + <di:waypoint x="580" y="350" /> + <di:waypoint x="630" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0r8ad9j_di" bpmnElement="Task_0y1n9ls"> + <dc:Bounds x="480" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSliceService.bpmn new file mode 100644 index 0000000000..6d9df5240d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSliceService.bpmn @@ -0,0 +1,332 @@ +<?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:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0prw6yo" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> + <bpmn:process id="DeleteSliceService" name="DeleteSliceService" isExecutable="true"> + <bpmn:startEvent id="StartEvent_1" name="start"> + <bpmn:outgoing>SequenceFlow_1ti9sxe</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_0xmiev9" sourceRef="Task_1f3k0gq" targetRef="Task_0gsr9fu" /> + <bpmn:sequenceFlow id="SequenceFlow_1ti9sxe" sourceRef="StartEvent_1" targetRef="Task_1f3k0gq" /> + <bpmn:scriptTask id="Task_1f3k0gq" name="PreProcess Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1ti9sxe</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0xmiev9</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dss= new DeleteSliceService() +dss.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="Task_0gsr9fu" name="Init Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="NSMF_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="NSMF_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0xmiev9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0uehx9h</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0uehx9h" sourceRef="Task_0gsr9fu" targetRef="Task_0walqr6" /> + <bpmn:scriptTask id="Task_0walqr6" name="Send Async Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0uehx9h</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_16lh6o6</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dss= new DeleteSliceService() +dss.sendAsyncResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_16lh6o6" sourceRef="Task_0walqr6" targetRef="Task_04n2tl9" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_1mcgr3m" name="success?"> + <bpmn:incoming>SequenceFlow_0nl4kfh</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0wel7ie</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0eqx2y2</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0nl4kfh" sourceRef="Task_04n2tl9" targetRef="ExclusiveGateway_1mcgr3m" /> + <bpmn:sequenceFlow id="SequenceFlow_0wel7ie" name="yes" sourceRef="ExclusiveGateway_1mcgr3m" targetRef="Task_01siwzc"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") == null}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0eqx2y2" name="no" sourceRef="ExclusiveGateway_1mcgr3m" targetRef="EndEvent_02ix4tc" /> + <bpmn:endEvent id="EndEvent_02ix4tc"> + <bpmn:incoming>SequenceFlow_0eqx2y2</bpmn:incoming> + <bpmn:errorEventDefinition errorRef="Error_1jz8wj7" /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_18oizb2" sourceRef="Task_0k1pi3g" targetRef="Task_1vklzip" /> + <bpmn:scriptTask id="Task_0k1pi3g" name="Delete slice service From AAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0wel7ie</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18oizb2</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dss= new DeleteSliceService() +dss.deleteSliceServiceInstance(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="Task_1vklzip" name="Update Service Operation Status to Success"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">${UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth", execution)}</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${updateOperationStatus}</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_18oizb2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1oxmm7d</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:endEvent id="EndEvent_0tyqdpw" name="End"> + <bpmn:incoming>SequenceFlow_1oxmm7d</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1oxmm7d" sourceRef="Task_1vklzip" targetRef="EndEvent_0tyqdpw" /> + <bpmn:callActivity id="Task_04n2tl9" name="Do Delete SliceServiceV1" calledElement="DoDeleteSliceServiceV1"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="serviceType" target="serviceType" /> + <camunda:in source="operationId" target="operationId" /> + <camunda:in source="operationType" target="operationType" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_16lh6o6</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0nl4kfh</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="Task_01siwzc" name="Delete Service Profile From AAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0wel7ie</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_142j1q2</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dss= new DeleteSliceService() +dss.delServiceProfileFromAAI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_142j1q2" sourceRef="Task_01siwzc" targetRef="Task_0k1pi3g" /> + <bpmn:subProcess id="SubProcess_07kf25g" name="Java Exception Handling Sub Process" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_1qskwib"> + <bpmn:outgoing>SequenceFlow_0x8msq9</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_1mmlos4" /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_086jahv"> + <bpmn:incoming>SequenceFlow_10lwgo7</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0x8msq9" sourceRef="StartEvent_1qskwib" targetRef="ScriptTask_19sjlk2" /> + <bpmn:scriptTask id="ScriptTask_19sjlk2" name="Send Error Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0x8msq9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ihiv5k</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dss = new DeleteCustomE2EServiceInstance() +dss.sendSyncError(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1ihiv5k" sourceRef="ScriptTask_19sjlk2" targetRef="Task_1fxg7am" /> + <bpmn:sequenceFlow id="SequenceFlow_0zvzs12" sourceRef="Task_1fxg7am" targetRef="ServiceTask_17jq3cx" /> + <bpmn:scriptTask id="Task_1fxg7am" name="Termination Service Operation Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1ihiv5k</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0zvzs12</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dss = new DeleteSliceService() +dss.prepareEndOperationStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_17jq3cx" name="Update Service Operation Status To Terminate"> + <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 YnBlbDpwYXNzd29yZDEk</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_0zvzs12</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_10lwgo7</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_10lwgo7" sourceRef="ServiceTask_17jq3cx" targetRef="EndEvent_086jahv" /> + </bpmn:subProcess> + <bpmn:subProcess id="SubProcess_0so7l00" name="Sub-process for UnexpectedErrors" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_1jknl5k"> + <bpmn:outgoing>SequenceFlow_0rasmiu</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_0rasmiu" sourceRef="StartEvent_1jknl5k" targetRef="Task_0c422xd" /> + <bpmn:endEvent id="EndEvent_1vr9nc9"> + <bpmn:incoming>SequenceFlow_1jipldf</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1jipldf" sourceRef="Task_0c422xd" targetRef="EndEvent_1vr9nc9" /> + <bpmn:scriptTask id="Task_0c422xd" name="Handle Unexpected Error" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0rasmiu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1jipldf</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)</bpmn:script> + </bpmn:scriptTask> + </bpmn:subProcess> + </bpmn:process> + <bpmn:error id="Error_1jz8wj7" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteSliceService"> + <bpmndi:BPMNEdge id="SequenceFlow_1ti9sxe_di" bpmnElement="SequenceFlow_1ti9sxe"> + <di:waypoint x="188" y="117" /> + <di:waypoint x="290" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0xmiev9_di" bpmnElement="SequenceFlow_0xmiev9"> + <di:waypoint x="390" y="117" /> + <di:waypoint x="480" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="152" y="99" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="159" y="142" width="23" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0aqhg4z_di" bpmnElement="Task_1f3k0gq"> + <dc:Bounds x="290" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1n9ja9t_di" bpmnElement="Task_0gsr9fu"> + <dc:Bounds x="480" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0uehx9h_di" bpmnElement="SequenceFlow_0uehx9h"> + <di:waypoint x="580" y="117" /> + <di:waypoint x="660" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_13qpvgg_di" bpmnElement="Task_0walqr6"> + <dc:Bounds x="660" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_16lh6o6_di" bpmnElement="SequenceFlow_16lh6o6"> + <di:waypoint x="760" y="117" /> + <di:waypoint x="840" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_1mcgr3m_di" bpmnElement="ExclusiveGateway_1mcgr3m" isMarkerVisible="true"> + <dc:Bounds x="1025" y="92" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1026" y="73" width="47" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0nl4kfh_di" bpmnElement="SequenceFlow_0nl4kfh"> + <di:waypoint x="940" y="117" /> + <di:waypoint x="1025" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0wel7ie_di" bpmnElement="SequenceFlow_0wel7ie"> + <di:waypoint x="1075" y="117" /> + <di:waypoint x="1164" y="117" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1100" y="98" width="17" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0eqx2y2_di" bpmnElement="SequenceFlow_0eqx2y2"> + <di:waypoint x="1050" y="142" /> + <di:waypoint x="1050" y="202" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1059" y="169" width="13" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_169jlln_di" bpmnElement="EndEvent_02ix4tc"> + <dc:Bounds x="1032" y="202" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_18oizb2_di" bpmnElement="SequenceFlow_18oizb2"> + <di:waypoint x="1440" y="117" /> + <di:waypoint x="1530" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_10g3cz7_di" bpmnElement="Task_0k1pi3g"> + <dc:Bounds x="1340" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0pct2ne_di" bpmnElement="Task_1vklzip"> + <dc:Bounds x="1530" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0tyqdpw_di" bpmnElement="EndEvent_0tyqdpw"> + <dc:Bounds x="1562" y="202" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1570" y="245" width="20" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1oxmm7d_di" bpmnElement="SequenceFlow_1oxmm7d"> + <di:waypoint x="1580" y="157" /> + <di:waypoint x="1580" y="202" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1igxzig_di" bpmnElement="Task_04n2tl9"> + <dc:Bounds x="840" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0qqsp7x_di" bpmnElement="Task_01siwzc"> + <dc:Bounds x="1164" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_142j1q2_di" bpmnElement="SequenceFlow_142j1q2"> + <di:waypoint x="1264" y="117" /> + <di:waypoint x="1340" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_07kf25g_di" bpmnElement="SubProcess_07kf25g" isExpanded="true"> + <dc:Bounds x="340" y="430" width="637" height="162" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1qskwib_di" bpmnElement="StartEvent_1qskwib"> + <dc:Bounds x="377" y="497" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_086jahv_di" bpmnElement="EndEvent_086jahv"> + <dc:Bounds x="902" y="497" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0x8msq9_di" bpmnElement="SequenceFlow_0x8msq9"> + <di:waypoint x="413" y="515" /> + <di:waypoint x="456" y="515" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_19sjlk2_di" bpmnElement="ScriptTask_19sjlk2"> + <dc:Bounds x="456" y="475" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ihiv5k_di" bpmnElement="SequenceFlow_1ihiv5k"> + <di:waypoint x="556" y="515" /> + <di:waypoint x="615" y="515" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0zvzs12_di" bpmnElement="SequenceFlow_0zvzs12"> + <di:waypoint x="715" y="515" /> + <di:waypoint x="765" y="515" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0bjcnd3_di" bpmnElement="Task_1fxg7am"> + <dc:Bounds x="615" y="475" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_17jq3cx_di" bpmnElement="ServiceTask_17jq3cx"> + <dc:Bounds x="765" y="475" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_10lwgo7_di" bpmnElement="SequenceFlow_10lwgo7"> + <di:waypoint x="865" y="515" /> + <di:waypoint x="902" y="515" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_1dd77tu_di" bpmnElement="SubProcess_0so7l00" isExpanded="true"> + <dc:Bounds x="470" y="650" width="350" height="200" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_14mwxm0_di" bpmnElement="StartEvent_1jknl5k"> + <dc:Bounds x="510" y="732" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0rasmiu_di" bpmnElement="SequenceFlow_0rasmiu"> + <di:waypoint x="546" y="750" /> + <di:waypoint x="600" y="750" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_1vr9nc9_di" bpmnElement="EndEvent_1vr9nc9"> + <dc:Bounds x="762" y="732" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1jipldf_di" bpmnElement="SequenceFlow_1jipldf"> + <di:waypoint x="700" y="750" /> + <di:waypoint x="762" y="750" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0vb5d51_di" bpmnElement="Task_0c422xd"> + <dc:Bounds x="600" y="710" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParams.java b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParams.java new file mode 100644 index 0000000000..bf881c0f19 --- /dev/null +++ b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParams.java @@ -0,0 +1,413 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 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.beans.nsmf; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.JsonObject; +import java.io.IOException; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +public class SliceTaskParams implements Serializable { + + private static final long serialVersionUID = -4389946152970978423L; + + private String serviceId; + + private String serviceName; + + private String nstId; + + private String nstName; + + private String tnScriptName; + + private String anScriptName; + + private String cnScriptName; + + private Map<String, Object> serviceProfile; + + private String suggestNsiId; + + private String suggestNsiName; + + private Map<String, Object> sliceProfileTn; + + private Map<String, Object> sliceProfileCn; + + private Map<String, Object> sliceProfileAn; + + private String tnSuggestNssiId; + + private String tnSuggestNssiName; + + private String tnProgress; + + private String tnStatus; + + private String tnStatusDescription; + + private String cnSuggestNssiId; + + private String cnSuggestNssiName; + + private String cnProgress; + + private String cnStatus; + + private String cnStatusDescription; + + private String anSuggestNssiId; + + private String anSuggestNssiName; + + private String anProgress; + + private String anStatus; + + private String anStatusDescription; + + public String getNstId() { + return nstId; + } + + public void setNstId(String nstId) { + this.nstId = nstId; + } + + public String getNstName() { + return nstName; + } + + public void setNstName(String nstName) { + this.nstName = nstName; + } + + public String getTnScriptName() { + return tnScriptName; + } + + public void setTnScriptName(String tnScriptName) { + this.tnScriptName = tnScriptName; + } + + public String getAnScriptName() { + return anScriptName; + } + + public void setAnScriptName(String anScriptName) { + this.anScriptName = anScriptName; + } + + public String getCnScriptName() { + return cnScriptName; + } + + public void setCnScriptName(String cnScriptName) { + this.cnScriptName = cnScriptName; + } + + public String getServiceId() { + return serviceId; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + public String getServiceName() { + return serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + public Map<String, Object> getServiceProfile() { + return serviceProfile; + } + + public void setServiceProfile(Map<String, Object> serviceProfile) { + this.serviceProfile = serviceProfile; + } + + public String getSuggestNsiId() { + return suggestNsiId; + } + + public void setSuggestNsiId(String suggestNsiId) { + this.suggestNsiId = suggestNsiId; + } + + public String getSuggestNsiName() { + return suggestNsiName; + } + + public void setSuggestNsiName(String suggestNsiName) { + this.suggestNsiName = suggestNsiName; + } + + public Map<String, Object> getSliceProfileTn() { + return sliceProfileTn; + } + + public void setSliceProfileTn(Map<String, Object> sliceProfileTn) { + this.sliceProfileTn = sliceProfileTn; + } + + public Map<String, Object> getSliceProfileCn() { + return sliceProfileCn; + } + + public void setSliceProfileCn(Map<String, Object> sliceProfileCn) { + this.sliceProfileCn = sliceProfileCn; + } + + public Map<String, Object> getSliceProfileAn() { + return sliceProfileAn; + } + + public void setSliceProfileAn(Map<String, Object> sliceProfileAn) { + this.sliceProfileAn = sliceProfileAn; + } + + public String getTnSuggestNssiId() { + return tnSuggestNssiId; + } + + public void setTnSuggestNssiId(String tnSuggestNssiId) { + this.tnSuggestNssiId = tnSuggestNssiId; + } + + public String getTnSuggestNssiName() { + return tnSuggestNssiName; + } + + public void setTnSuggestNssiName(String tnSuggestNssiName) { + this.tnSuggestNssiName = tnSuggestNssiName; + } + + public String getTnProgress() { + return tnProgress; + } + + public void setTnProgress(String tnProgress) { + this.tnProgress = tnProgress; + } + + public String getTnStatus() { + return tnStatus; + } + + public void setTnStatus(String tnStatus) { + this.tnStatus = tnStatus; + } + + public String getTnStatusDescription() { + return tnStatusDescription; + } + + public void setTnStatusDescription(String tnStatusDescription) { + this.tnStatusDescription = tnStatusDescription; + } + + public String getCnSuggestNssiId() { + return cnSuggestNssiId; + } + + public void setCnSuggestNssiId(String cnSuggestNssiId) { + this.cnSuggestNssiId = cnSuggestNssiId; + } + + public String getCnSuggestNssiName() { + return cnSuggestNssiName; + } + + public void setCnSuggestNssiName(String cnSuggestNssiName) { + this.cnSuggestNssiName = cnSuggestNssiName; + } + + public String getCnProgress() { + return cnProgress; + } + + public void setCnProgress(String cnProgress) { + this.cnProgress = cnProgress; + } + + public String getCnStatus() { + return cnStatus; + } + + public void setCnStatus(String cnStatus) { + this.cnStatus = cnStatus; + } + + public String getCnStatusDescription() { + return cnStatusDescription; + } + + public void setCnStatusDescription(String cnStatusDescription) { + this.cnStatusDescription = cnStatusDescription; + } + + public String getAnSuggestNssiId() { + return anSuggestNssiId; + } + + public void setAnSuggestNssiId(String anSuggestNssiId) { + this.anSuggestNssiId = anSuggestNssiId; + } + + public String getAnSuggestNssiName() { + return anSuggestNssiName; + } + + public void setAnSuggestNssiName(String anSuggestNssiName) { + this.anSuggestNssiName = anSuggestNssiName; + } + + public String getAnProgress() { + return anProgress; + } + + public void setAnProgress(String anProgress) { + this.anProgress = anProgress; + } + + public String getAnStatus() { + return anStatus; + } + + public void setAnStatus(String anStatus) { + this.anStatus = anStatus; + } + + public String getAnStatusDescription() { + return anStatusDescription; + } + + public void setAnStatusDescription(String anStatusDescription) { + this.anStatusDescription = anStatusDescription; + } + + public String convertToJson() { + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty("ServiceId", serviceId); + jsonObject.addProperty("ServiceName", serviceName); + jsonObject.addProperty("NSTId", nstId); + jsonObject.addProperty("NSTName", nstName); + jsonObject.addProperty("TN.ScriptName", tnScriptName); + jsonObject.addProperty("AN.ScriptName", anScriptName); + jsonObject.addProperty("CN.ScriptName", cnScriptName); + for (Map.Entry<String, Object> entry : serviceProfile.entrySet()) { + jsonObject.addProperty("ServiceProfile." + entry.getKey(), entry.getValue().toString()); + } + jsonObject.addProperty("suggestNSIId", suggestNsiId); + jsonObject.addProperty("suggestNSIName", suggestNsiName); + for (Map.Entry<String, Object> entry : sliceProfileTn.entrySet()) { + jsonObject.addProperty("SliceProfile.TN." + entry.getKey(), entry.getValue().toString()); + } + for (Map.Entry<String, Object> entry : sliceProfileCn.entrySet()) { + jsonObject.addProperty("SliceProfile.CN." + entry.getKey(), entry.getValue().toString()); + } + for (Map.Entry<String, Object> entry : sliceProfileAn.entrySet()) { + jsonObject.addProperty("SliceProfile.AN." + entry.getKey(), entry.getValue().toString()); + } + jsonObject.addProperty("TN.SuggestNSSIId", tnSuggestNssiId); + jsonObject.addProperty("TN.SuggestNSSIName", tnSuggestNssiName); + jsonObject.addProperty("TN.progress", tnProgress); + jsonObject.addProperty("TN.status", tnStatus); + jsonObject.addProperty("TN.statusDescription", tnStatusDescription); + jsonObject.addProperty("CN.SuggestNSSIId", cnSuggestNssiId); + jsonObject.addProperty("CN.SuggestNSSIName", cnSuggestNssiName); + jsonObject.addProperty("CN.progress", cnProgress); + jsonObject.addProperty("CN.status", cnStatus); + jsonObject.addProperty("CN.statusDescription", cnStatusDescription); + jsonObject.addProperty("AN.SuggestNSSIId", anSuggestNssiId); + jsonObject.addProperty("AN.SuggestNSSIName", anSuggestNssiName); + jsonObject.addProperty("AN.progress", anProgress); + jsonObject.addProperty("AN.status", anStatus); + jsonObject.addProperty("AN.statusDescription", anStatusDescription); + + return jsonObject.toString(); + } + + public void convertFromJson(String jsonString) throws IOException { + ObjectMapper mapper = new ObjectMapper(); + Map<String, String> paramMap = (Map<String, String>) mapper.readValue(jsonString, Map.class); + this.setServiceId(paramMap.get("ServiceId")); + this.setServiceName(paramMap.get("ServiceName")); + this.setNstId(paramMap.get("NSTId")); + this.setNstName(paramMap.get("NSTName")); + this.setTnScriptName(paramMap.get("TN.ScriptName")); + this.setAnScriptName(paramMap.get("AN.ScriptName")); + this.setCnScriptName(paramMap.get("CN.ScriptName")); + Map<String, Object> serviceProfileMap = new HashMap<>(); + for (Map.Entry<String, String> entry : paramMap.entrySet()) { + if (entry.getKey().startsWith("ServiceProfile.")) { + serviceProfileMap.put(entry.getKey().replaceFirst("^ServiceProfile.", ""), entry.getValue()); + } + } + this.setServiceProfile(serviceProfileMap); + this.setSuggestNsiId(paramMap.get("suggestNSIId")); + this.setSuggestNsiName(paramMap.get("suggestNSIName")); + Map<String, Object> sliceProfileTnMap = new HashMap<>(); + for (Map.Entry<String, String> entry : paramMap.entrySet()) { + if (entry.getKey().startsWith("SliceProfile.TN.")) { + sliceProfileTnMap.put(entry.getKey().replaceFirst("^SliceProfile.TN.", ""), entry.getValue()); + } + } + this.setSliceProfileTn(sliceProfileTnMap); + Map<String, Object> sliceProfileCnMap = new HashMap<>(); + for (Map.Entry<String, String> entry : paramMap.entrySet()) { + if (entry.getKey().startsWith("SliceProfile.CN.")) { + sliceProfileCnMap.put(entry.getKey().replaceFirst("^SliceProfile.CN.", ""), entry.getValue()); + } + } + this.setSliceProfileCn(sliceProfileCnMap); + Map<String, Object> sliceProfileAnMap = new HashMap<>(); + for (Map.Entry<String, String> entry : paramMap.entrySet()) { + if (entry.getKey().startsWith("SliceProfile.AN.")) { + sliceProfileAnMap.put(entry.getKey().replaceFirst("^SliceProfile.AN.", ""), entry.getValue()); + } + } + this.setSliceProfileAn(sliceProfileAnMap); + this.setTnSuggestNssiId(paramMap.get("TN.SuggestNSSIId")); + this.setTnSuggestNssiName(paramMap.get("TN.SuggestNSSIName")); + this.setTnProgress(paramMap.get("TN.progress")); + this.setTnStatus(paramMap.get("TN.status")); + this.setTnStatusDescription(paramMap.get("TN.statusDescription")); + this.setCnSuggestNssiId(paramMap.get("CN.SuggestNSSIId")); + this.setCnSuggestNssiName(paramMap.get("CN.SuggestNSSIName")); + this.setCnProgress(paramMap.get("CN.progress")); + this.setCnStatus(paramMap.get("CN.status")); + this.setCnStatusDescription(paramMap.get("CN.statusDescription")); + this.setAnSuggestNssiId(paramMap.get("AN.SuggestNSSIId")); + this.setAnSuggestNssiName(paramMap.get("AN.SuggestNSSIName")); + this.setAnProgress(paramMap.get("AN.progress")); + this.setAnStatus(paramMap.get("AN.status")); + this.setAnStatusDescription(paramMap.get("AN.statusDescription")); + } +} + |