diff options
13 files changed, 3620 insertions, 2 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy index 606b97bec2..34cbb00735 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.fasterxml.jackson.databind.ObjectMapper import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -529,4 +530,24 @@ class OofUtils { return UriBuilder.fromPath("").host(msbHost).port(msbPort).scheme("http").build().toString() } + + public String buildSelectNSTRequest(String requestId, Map<String, Object> profileInfo) { + def transactionId = requestId + logger.debug( "transactionId is: " + transactionId) + ObjectMapper objectMapper = new ObjectMapper() + String json = objectMapper.writeValueAsString(profileInfo) + StringBuilder response = new StringBuilder() + response.append( + "{\n" + + " \"requestInfo\": {\n" + + " \"transactionId\": \"${transactionId}\",\n" + + " \"requestId\": \"${requestId}\",\n" + + " \"sourceId\": \"so\",\n" + + " \"timeout\": 600\n" + + " },\n") + response.append(",\n \"serviceInfo\": \n") + response.append(json); + response.append("\n }\n") + return response.toString() + } } diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInfo.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInfo.java new file mode 100644 index 0000000000..542fa2d463 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInfo.java @@ -0,0 +1,97 @@ +/*- + * ============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.core.domain; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.*; + + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"id", "serviceInput", "serviceProperties", "serviceArtifact"}) +@JsonRootName("serviceInfo") +public class ServiceInfo extends JsonWrapper implements Serializable { + private static final long serialVersionUID = 1L; + @JsonProperty("id") + private Integer id; + @JsonProperty("serviceInput") + private String serviceInput; + @JsonProperty("serviceProperties") + private String serviceProperties; + @JsonProperty("serviceArtifact") + private List<ServiceArtifact> serviceArtifact = null; + @JsonIgnore + private Map<String, Object> additionalProperties = new HashMap<String, Object>(); + + @JsonProperty("id") + public Integer getId() { + return id; + } + + @JsonProperty("id") + public void setId(Integer id) { + this.id = id; + } + + @JsonProperty("serviceInput") + public String getServiceInput() { + return serviceInput; + } + + @JsonProperty("serviceInput") + public void setServiceInput(String serviceInput) { + this.serviceInput = serviceInput; + } + + @JsonProperty("serviceProperties") + public String getServiceProperties() { + return serviceProperties; + } + + @JsonProperty("serviceProperties") + public void setServiceProperties(String serviceProperties) { + this.serviceProperties = serviceProperties; + } + + @JsonProperty("serviceArtifact") + public List<ServiceArtifact> getServiceArtifact() { + return serviceArtifact; + } + + @JsonProperty("serviceArtifact") + public void setServiceArtifact(List<ServiceArtifact> serviceArtifact) { + this.serviceArtifact = serviceArtifact; + } + + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + +} + + diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceProxy.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceProxy.java new file mode 100644 index 0000000000..6903d34987 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceProxy.java @@ -0,0 +1,78 @@ +/*- + * ============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.core.domain; + +import java.io.Serializable; +import com.fasterxml.jackson.annotation.*; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"modelInfo", "toscaNodeType", "description", "sourceModelUuid"}) +@JsonRootName("serviceProxy") +public class ServiceProxy extends JsonWrapper implements Serializable { + private static final long serialVersionUID = 1L; + @JsonProperty("modelInfo") + private ModelInfo modelInfo; + @JsonProperty("toscaNodeType") + private String toscaNodeType; + @JsonProperty("description") + private String description; + @JsonProperty("sourceModelUuid") + private String sourceModelUuid; + + @JsonProperty("modelInfo") + public ModelInfo getModelInfo() { + return modelInfo; + } + + @JsonProperty("modelInfo") + public void setModelInfo(ModelInfo modelInfo) { + this.modelInfo = modelInfo; + } + + @JsonProperty("toscaNodeType") + public String getToscaNodeType() { + return toscaNodeType; + } + + @JsonProperty("toscaNodeType") + public void setToscaNodeType(String toscaNodeType) { + this.toscaNodeType = toscaNodeType; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("description") + public void setDescription(String description) { + this.description = description; + } + + @JsonProperty("sourceModelUuid") + public String getSourceModelUuid() { + return sourceModelUuid; + } + + @JsonProperty("sourceModelUuid") + public void setSourceModelUuid(String sourceModelUuid) { + this.sourceModelUuid = sourceModelUuid; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy new file mode 100644 index 0000000000..630148e899 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy @@ -0,0 +1,585 @@ +/*- + * ============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.bpmn.infrastructure.scripts + +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.* +import org.onap.so.beans.nsmf.NSSI +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.onap.so.logger.ErrorCode +import org.onap.so.logger.LoggingAnchor +import org.onap.so.logger.MessageEnum +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +import javax.ws.rs.NotFoundException +import java.lang.reflect.Type + +import static org.apache.commons.lang3.StringUtils.isBlank + +/** + * This groovy class supports the <class>ActivateSliceService.bpmn</class> process. + * AlaCarte flow for 1702 slice service activate + * + */ + +class ActivateSliceService extends AbstractServiceTaskProcessor { + + + String Prefix = "ACTSS_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + RequestDBUtil requestDBUtil = new RequestDBUtil() + + private static final Logger logger = LoggerFactory.getLogger(ActivateSliceService.class) + + void preProcessRequest(DelegateExecution execution) { + logger.debug(Prefix + "preProcessRequest Start") + execution.setVariable("prefix", Prefix) + String msg + + try { + // check for incoming json message/input + String siRequest = execution.getVariable("bpmnRequest") + logger.debug(siRequest) + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + logger.info("Input Request:" + siRequest + " reqId:" + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + msg = "Input serviceInstanceId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + String source = jsonUtil.getJsonValue(siRequest, "source") + execution.setVariable("source", source) + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + logger.info(msg) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //requestParameters + String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "serviceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + logger.debug(msg) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + } + String operationId = jsonUtil.getJsonValue(siRequest, "operationId") + execution.setVariable("operationId", operationId) + + execution.getVariable("operationType") + logger.info("operationType is " + execution.getVariable("operationType") ) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in preProcessRequest " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "preProcessRequest Exit") + } + + + def sendSyncResponse = { DelegateExecution execution -> + logger.debug(Prefix + "sendSyncResponse Start") + try { + String operationId = execution.getVariable("operationId") + // RESTResponse for API Handler (APIH) Reply Task + String Activate5GsliceServiceRestRequest = """{"operationId":"${operationId}"}""".trim() + logger.debug(" sendSyncResponse to APIH:" + "\n" + Activate5GsliceServiceRestRequest) + sendWorkflowResponse(execution, 202, Activate5GsliceServiceRestRequest) + execution.setVariable("sentSyncResponse", true) + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "sendSyncResponse Exit") + } + + + public sendSyncError = { DelegateExecution execution -> + logger.debug("sendSyncError Start") + try { + String errorMessage + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") as 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.debug("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + logger.debug(Prefix + "sendSyncError Exit") + } + + + def prepareCompletionRequest = { DelegateExecution execution -> + logger.debug(Prefix + "prepareCompletionRequest Start") + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String userId = execution.getVariable("globalSubscriberId") + //String result = execution.getVariable("result") + String result = "finished" + String progress = "100" + String reason = "" + String operationContent = execution.getVariable("operationContent") + String operationType = execution.getVariable("operationType") + + OperationStatus initStatus = new OperationStatus() + initStatus.setServiceId(serviceId) + initStatus.setOperationId(operationId) + initStatus.setOperation(operationType) + initStatus.setUserId(userId) + initStatus.setResult(result) + initStatus.setProgress(progress) + initStatus.setReason(reason) + initStatus.setOperationContent(operationContent) + + requestDBUtil.prepareUpdateOperationStatus(execution, initStatus) + + logger.debug(Prefix + "prepareCompletionRequest Exit") + } + + + /** + * Init the service Operation Status + */ + def prepareInitServiceOperationStatus = { DelegateExecution execution -> + logger.debug(Prefix + "prepareActivateServiceOperationStatus Start") + try { + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = execution.getVariable("operationType") + String userId = execution.getVariable("globalSubscriberId") + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service activation" + + execution.setVariable("e2eserviceInstanceId", serviceId) + execution.setVariable("operationType", operationType) + + OperationStatus initStatus = new OperationStatus() + initStatus.setServiceId(serviceId) + initStatus.setOperationId(operationId) + initStatus.setOperation(operationType) + initStatus.setUserId(userId) + initStatus.setResult(result) + initStatus.setProgress(progress) + initStatus.setReason(reason) + initStatus.setOperationContent(operationContent) + + requestDBUtil.prepareUpdateOperationStatus(execution, initStatus) + + } catch (Exception e) { + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) + execution.setVariable("CVFMI_ErrorResponse", + "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) + } + logger.debug(Prefix + "prepareInitServiceOperationStatus Exit") + } + + + private getSNSSIStatusByNsi = { DelegateExecution execution, String NSIServiceId -> + + logger.debug(Prefix + "getSNSSIStatusByNsi Start") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalSubscriberId, subscriptionServiceType, NSIServiceId) + if (!client.exists(uri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") + } + AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + if (si.isPresent()) { + + List<Relationship> relatedList = si.get().getRelationshipList().getRelationship() + for (Relationship relationship : relatedList) { + String relatedTo = relationship.getRelatedTo() + if (relatedTo.toLowerCase() == "allotted-resource") { + //get snssi from allotted resource in list by nsi + List<String> SNSSIList = new ArrayList<>() + List<RelationshipData> relationshipDataList = relationship.getRelationshipData() + for (RelationshipData relationshipData : relationshipDataList) { + if (relationshipData.getRelationshipKey() == "service-instance.service-instance-id") { + SNSSIList.add(relationshipData.getRelationshipValue()) + } + } + for (String snssi : SNSSIList) { + AAIResourcesClient client01 = new AAIResourcesClient() + AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalSubscriberId, subscriptionServiceType, snssi) + if (!client.exists(uri01)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, + "Service Instance was not found in aai") + } + AAIResultWrapper wrapper01 = client01.get(uri01, NotFoundException.class) + Optional<ServiceInstance> nssiSi = wrapper01.asBean(ServiceInstance.class) + if (nssiSi.isPresent()) { + return nssiSi.get().getOrchestrationStatus() == "deactivated" + } + } + + } + } + + } + logger.debug(Prefix + "getSNSSIStatusByNsi Exit") + } + + + def updateStatusSNSSAIandNSIandNSSI = { DelegateExecution execution -> + logger.debug(Prefix + "updateStatusSNSSAIandNSIandNSSI Start") + logger.debug(" ***** update SNSSAI NSI NSSI slicing ***** ") + String e2eserviceInstanceId = execution.getVariable("e2eserviceInstanceId") + String NSIserviceInstanceId = execution.getVariable("NSIserviceid") + + String globalCustId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + String operationType = execution.getVariable("operationType") + + String nssiMap = execution.getVariable("nssiMap") + Type type = new TypeToken<HashMap<String, NSSI>>() {}.getType() + Map<String, NSSI> activateNssiMap = new Gson().fromJson(nssiMap, type) + //update tn/cn/an nssi + for (Map.Entry<String, NSSI> entry : activateNssiMap.entrySet()) { + NSSI nssi = entry.getValue() + String nssiid = nssi.getNssiId() + updateStratus(execution, globalCustId, serviceType, nssiid, operationType) + } + if (operationType == "activation") { + //update the s-nssai + updateStratus(execution, globalCustId, serviceType, e2eserviceInstanceId, operationType) + //update the nsi + updateStratus(execution, globalCustId, serviceType, NSIserviceInstanceId, operationType) + } else { + //update the s-nssai + updateStratus(execution, globalCustId, serviceType, e2eserviceInstanceId, operationType) + boolean flag = getSNSSIStatusByNsi(execution, NSIserviceInstanceId) + if (flag) { + //update the nsi + updateStratus(execution, globalCustId, serviceType, NSIserviceInstanceId, operationType) + } else { + logger.error("Service's status update failed") + String msg = "Service's status update failed" + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + logger.debug(Prefix + "updateStatusSNSSAIandNSIandNSSI Exit") + } + + + def updateStratus = { DelegateExecution execution, String globalCustId, + String serviceType, String serviceId, String operationType -> + logger.debug(Prefix + "updateStratus Start") + + try { + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalCustId, serviceType, serviceId) + if (!client.exists(uri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") + } + AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + + if (si.isPresent()) { + if (operationType == "activation") { + if (si.get().getOrchestrationStatus() == "deactivated") { + si.get().setOrchestrationStatus("activated") + client.update(uri, si.get()) + } + } else { + if (si.get().getOrchestrationStatus() == "activated") { + si.get().setOrchestrationStatus("deactivated") + client.update(uri, si.get()) + } + } + + } + } catch (Exception e) { + logger.info("Service is already in active state") + String msg = "Service is already in active state, " + e.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + logger.debug(Prefix + "updateStratus Exit") + } + + + def prepareActivation = { DelegateExecution execution -> + logger.debug(Prefix + "prepareActivation Start") + + logger.debug(" ***** prepare active NSI/AN/CN/TN slice ***** ") + String NSIserviceInstanceId = execution.getVariable("NSIserviceid") + + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + + Map<String, NSSI> nssiMap = new HashMap<>() + + List<String> activationSequence = new ArrayList<>(Arrays.asList("an", "tn", "cn")) + + def activationCount = activationSequence.size() + + execution.setVariable("activationIndex", "0") + + execution.setVariable("activationCount", activationCount) + try { + //get the TN NSSI id by NSI id, active NSSI TN slicing + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalSubscriberId, subscriptionServiceType, NSIserviceInstanceId) + if (!client.exists(uri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") + } + AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + if (si.isPresent()) { + + List<Relationship> relatedList = si.get().getRelationshipList().getRelationship() + for (Relationship relationship : relatedList) { + String relatedTo = relationship.getRelatedTo() + if (relatedTo.toLowerCase() == "service-instance") { + String relatioshipurl = relationship.getRelatedLink() + String nssiserviceid = + relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length()) + + AAIResourcesClient client01 = new AAIResourcesClient() + AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalSubscriberId, subscriptionServiceType, nssiserviceid) + if (!client.exists(uri01)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, + "Service Instance was not found in aai") + } + AAIResultWrapper wrapper01 = client01.get(uri01, NotFoundException.class) + Optional<ServiceInstance> nssiSi = wrapper01.asBean(ServiceInstance.class) + if (nssiSi.isPresent()) { + if (nssiSi.get().getEnvironmentContext().toLowerCase().contains("an") + || nssiSi.get().getEnvironmentContext().toLowerCase().contains("cn") + || nssiSi.get().getEnvironmentContext().toLowerCase().contains("tn")) { + nssiMap.put(nssiSi.get().getEnvironmentContext(), + new NSSI(nssiSi.get().getServiceInstanceId(), + nssiSi.get().getModelInvariantId(), nssiSi.get().getModelVersionId())) + } + } + } + } + + + } + } catch (Exception e) { + String msg = "Requested service does not exist:" + e.getMessage() + logger.info("Service doesnt exist") + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + if (nssiMap.size() > 0) { + execution.setVariable("isNSSIActivate", "true") + String nssiMap01 = mapToJsonStr(nssiMap) + execution.setVariable("nssiMap", nssiMap01) + execution.setVariable("operation_type", "activate") + execution.setVariable("activationCount", nssiMap.size()) + logger.info("the nssiMap01 is :" + nssiMap01) + } else { + execution.setVariable("isNSSIActivate", "false") + } + + logger.debug(Prefix + "prepareActivation Exit") + } + + + private mapToJsonStr = { HashMap<String, NSSI> stringNSSIHashMap -> + HashMap<String, NSSI> map = new HashMap<String, NSSI>() + for (Map.Entry<String, NSSI> child : stringNSSIHashMap.entrySet()) { + map.put(child.getKey(), child.getValue()) + } + return new Gson().toJson(map) + } + + + def checkAAIOrchStatusofslice = { DelegateExecution execution -> + logger.debug(Prefix + "CheckAAIOrchStatus Start") + + String msg = "" + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + String operationType = execution.getVariable("operationType") + + logger.debug("serviceInstanceId: " + serviceInstanceId) + + //check the e2e slice status + try { + try { + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalSubscriberId, subscriptionServiceType, serviceInstanceId) + if (!client.exists(uri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, + "Service Instance was not found in aai") + } + AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + if (si.isPresent()) { + if (si.get().getOrchestrationStatus().toLowerCase() == "activated" && + operationType == "deactivation") { + logger.info("Service is in active state") + execution.setVariable("e2eservicestatus", "activated") + execution.setVariable("isContinue", "true") + String snssai = si.get().getEnvironmentContext() + execution.setVariable("snssai", snssai) + } else if ((si.get().getOrchestrationStatus().toLowerCase() == "deactivated" || + si.get().getOrchestrationStatus().toLowerCase() == "created") && + operationType == "activation") { + logger.info("Service is in de-activated state") + execution.setVariable("e2eservicestatus", "deactivated") + execution.setVariable("isContinue", "true") + String snssai = si.get().getEnvironmentContext() + execution.setVariable("snssai", snssai) + } else { + execution.setVariable("isContinue", "false") + } + } + } catch (Exception e) { + msg = "Requested e2eservice does not exist" + logger.info("e2eservice doesnt exist") + execution.setVariable("isContinue", "false") + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + //check the NSI is exist or the status of NSI is active or de-active + try { + + //get the allotted-resources by e2e slice id + AAIResourcesClient client_allotted = new AAIResourcesClient() + AAIResourceUri uri_allotted = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE_ALL, + globalSubscriberId, subscriptionServiceType, serviceInstanceId) + if (!client_allotted.exists(uri_allotted)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") + } + AAIResultWrapper wrapper_allotted = client_allotted.get(uri_allotted, NotFoundException.class) + Optional<AllottedResources> all_allotted = wrapper_allotted.asBean(AllottedResources.class) + + if (all_allotted.isPresent() && all_allotted.get().getAllottedResource()) { + List<AllottedResource> AllottedResourceList = all_allotted.get().getAllottedResource() + AllottedResource ar = AllottedResourceList.first() + String relatedLink = ar.getRelationshipList().getRelationship().first().getRelatedLink() + String nsiserviceid = relatedLink.substring(relatedLink.lastIndexOf("/") + 1, relatedLink.length()) + execution.setVariable("NSIserviceid", nsiserviceid) + logger.info("the NSI ID is:" + nsiserviceid) + + //Query nsi by nsi id + try { + //get the NSI id by e2e slice id + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalSubscriberId, subscriptionServiceType, nsiserviceid) + if (!client.exists(uri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, + "Service Instance was not found in aai") + } + AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + + if (si.isPresent()) { + if (si.get().getServiceRole().toLowerCase() == "nsi") { + if (si.get().getOrchestrationStatus() == "activated") { + logger.info("NSI services is in activated state") + execution.setVariable("NSIservicestatus", "activated") + } else { + logger.info("NSI services is in deactivated state") + execution.setVariable("NSIservicestatus", "deactivated") + } + } else { + logger.info("the service id" + si.get().getServiceInstanceId() + "is " + + si.get().getServiceRole()) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + } catch (Exception e) { + msg = "Requested NSI service does not exist:" + e.getMessage() + logger.info("NSI service doesnt exist") + execution.setVariable("isContinue", "false") + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + } catch (Exception e) { + msg = "Requested service does not exist: " + e.getMessage() + logger.info("NSI Service doesnt exist") + execution.setVariable("isActivate", "false") + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in org.onap.so.bpmn.common.scripts.CompleteMsoProcess.CheckAAIOrchStatus " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + logger.debug(Prefix + "CheckAAIOrchStatus Exit") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy new file mode 100644 index 0000000000..e3470cd011 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy @@ -0,0 +1,678 @@ +/*- + * ============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 groovy.json.JsonSlurper +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONObject +import org.onap.aai.domain.yang.Relationship +import org.onap.aai.domain.yang.ServiceInstance +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.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceInfo +import org.onap.so.bpmn.core.domain.ServiceProxy +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.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 org.springframework.web.util.UriUtils + +import static org.apache.commons.lang3.StringUtils.isBlank + +/** + * This groovy class supports the <class>DoCreateCommunicationService.bpmn</class> process. + * AlaCarte flow for 1702 ServiceInstance Create + * + */ +class CreateCommunicationService extends AbstractServiceTaskProcessor { + + String Prefix="CRESI_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + RequestDBUtil requestDBUtil = new RequestDBUtil() + + JsonUtils jsonUtil = new JsonUtils() + + AAIResourcesClient client = getAAIClient() + + private static final Logger logger = LoggerFactory.getLogger(CreateCommunicationService.class) + + @Override + void preProcessRequest(DelegateExecution execution) { + logger.debug(Prefix + "preProcessRequest Start") + execution.setVariable("prefix", Prefix) + execution.setVariable("startTime", System.currentTimeMillis()) + def msg + //execution.setVariable("bpmnRequest", InputString) + try { + // get request input + String siRequest = execution.getVariable("bpmnRequest") + logger.debug(siRequest) + + //String requestId = execution.getVariable("mso-request-id") + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + logger.debug("Input Request:" + siRequest + " reqId:" + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + serviceInstanceId = UUID.randomUUID().toString() + } + logger.debug("Generated new Service Instance:" + serviceInstanceId) + serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //requestInfo + execution.setVariable("source", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source")) + execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName")) + execution.setVariable("disableRollback", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.suppressRollback")) + String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") + if (isBlank(productFamilyId)) + { + msg = "Input productFamilyId is null" + logger.debug(msg) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("productFamilyId", productFamilyId) + } + + //modelInfo + String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") + if (isBlank(serviceModelInfo)) { + msg = "Input serviceModelInfo is null" + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else + { + execution.setVariable("csServiceModelInfo", serviceModelInfo) + } + + logger.debug("modelInfo: " + serviceModelInfo) + + //requestParameters, subscriptionServiceType is 5G + String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + // todo: in create e2e interface, this value is write "MOG", so write it as "5G" + execution.setVariable("subscriptionServiceType", "5G") + } + + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + + Map reqMap = jsonSlurper.parseText(siRequest) as Map + + //InputParams + def userParamsList = reqMap.requestDetails?.requestParameters?.userParams + + Map<String, String> inputMap = [:] + if (userParamsList) { + for (def i=0; i<userParamsList.size(); i++) { + def userParams1 = userParamsList.get(i) + userParams1.each { param -> inputMap.put(param.key, param.value)} + } + } + + logger.debug("User Input Parameters map: " + inputMap.toString()) + execution.setVariable("serviceInputParams", inputMap) + execution.setVariable("uuiRequest", inputMap.get("UUIRequest")) + execution.setVariable("isAllNSMFFinished", "false") + String operationId = UUID.randomUUID().toString() + execution.setVariable("operationId", operationId) + + } catch(BpmnError e) { + throw e + } catch(Exception ex) { + msg = "Exception in CreateCommunicationService.preProcessRequest " + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "preProcessRequest Exit") + } + + + /** + * create operation status in request db + * + * Init the Operation Status + */ + def prepareInitOperationStatus = { DelegateExecution execution -> + logger.debug(Prefix + "prepareInitOperationStatus Start") + + String serviceId = execution.getVariable("serviceInstanceId") + // 生成 operationId + String operationId = execution.getVariable("operationId") + logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) + + OperationStatus initStatus = new OperationStatus() + initStatus.setServiceId(serviceId) + initStatus.setOperationId(operationId) + initStatus.setOperation("CREATE") + initStatus.setUserId(execution.getVariable("globalSubscriberId") as String) + initStatus.setResult("processing") + initStatus.setProgress("0") + initStatus.setReason("") + initStatus.setOperationContent("communication service create operation start") + + requestDBUtil.prepareUpdateOperationStatus(execution, initStatus) + + logger.debug(Prefix + "prepareInitOperationStatus Exit") + } + + + /** + * return sync response + */ + def sendSyncResponse = { DelegateExecution execution -> + logger.debug(Prefix + "sendSyncResponse Start") + try { + String operationId = execution.getVariable("operationId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String createServiceRestRequest = """ + { + "service": { + "serviceId":"${serviceInstanceId}", + "operationId":"${operationId}" + } + } + """.trim().replaceAll(" ", "") + + logger.debug("sendSyncResponse to APIH:" + "\n" + createServiceRestRequest) + sendWorkflowResponse(execution, 202, createServiceRestRequest) + + execution.setVariable("sentSyncResponse", true) + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "sendSyncResponse Exit") + } + + + /** + * query e2e service + * @param execution + */ + def prepareDoComposeE2E = { DelegateExecution execution -> + logger.debug(Prefix + "prepareDoComposeE2E Start") + try { + ServiceDecomposition serviceDecomposition = execution.getVariable( + "csServiceDecomposition") as ServiceDecomposition + + logger.debug("serviceDecomposition is:" + serviceDecomposition.toJsonString()) + + List<ServiceProxy> serviceProxies = serviceDecomposition.getServiceProxy() + String sourceModelUuid = serviceProxies.get(0).getSourceModelUuid() + + JSONObject queryJson = new JSONObject() + queryJson.put("modelUuid", sourceModelUuid) + + execution.setVariable("e2eServiceModelInfo", queryJson.toString()) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in CreateCommunicationService.prepareDoComposeE2E. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + logger.debug(Prefix + "prepareDoComposeE2E Exit") + } + + + /** + * parse communication service params from request + * @param execution + */ + def parseCSParamsFromReq = { DelegateExecution execution -> + logger.debug(Prefix + "parseCSParamsFromReq Start") + try { + //1. CMS info + + String modelInfo = execution.getVariable("csServiceModelInfo") + String modelInvariantUuid = jsonUtil.getJsonValue(modelInfo, "modelInvariantUuid") + String modelUuid = jsonUtil.getJsonValue(modelInfo, "modelUuid") + + //String modelInvariantUuid = execution.getVariable("modelInvariantId") + //String modelUuid = execution.getVariable("modelUuid") + String uuiRequest = execution.getVariable("uuiRequest") + String useInterval = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.useInterval") + String csServiceName = jsonUtil.getJsonValue(uuiRequest, "service.name") + String csServiceDescription = jsonUtil.getJsonValue(uuiRequest, "service.description") + + execution.setVariable("modelInvariantUuid", modelInvariantUuid) + execution.setVariable("modelUuid", modelUuid) + execution.setVariable("useInterval", useInterval) + execution.setVariable("csServiceName", csServiceName) + execution.setVariable("csServiceDescription", csServiceDescription) + + + //2. profile info + Integer expDataRateDL = jsonUtil.getJsonIntValue(uuiRequest, "service.parameters.requestInputs.expDataRateDL") + Integer expDataRateUL = jsonUtil.getJsonIntValue(uuiRequest, "service.parameters.requestInputs.expDataRateUL") + Integer latency = jsonUtil.getJsonIntValue(uuiRequest, "service.parameters.requestInputs.latency") + Integer maxNumberOfUEs = jsonUtil.getJsonIntValue(uuiRequest, "service.parameters.requestInputs.maxNumberofUEs") + String uEMobilityLevel = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.uemobilityLevel") + String resourceSharingLevel = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.resourceSharingLevel") + String coverageArea = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.coverageAreaList") + + // from template construct input map + //String cstTemplate = execution.getVariable("cstTemplate") + ServiceDecomposition csServiceDecomposition = execution.getVariable( + "csServiceDecomposition") as ServiceDecomposition + //String csServiceType = jsonUtil.getJsonValue(cstTemplate, "serviceResources.serviceType") + String csServiceType = csServiceDecomposition.getServiceType() + execution.setVariable("csServiceType", csServiceType) + + //String cstTemplateInfo = jsonUtil.getJsonValue(cstTemplate, "serviceResources.serviceInfo.serviceInput") + ServiceInfo csServiceInfo = csServiceDecomposition.getServiceInfo() + String cstTemplateInfo = csServiceInfo.getServiceProperties() + + List<String> csInputs = jsonUtil.StringArrayToList(cstTemplateInfo) + + Map<String, ?> csInputMap = new HashMap<>() + for (String csInput : csInputs) { + def value + if (jsonUtil.getJsonValue(csInput, "type") == "integer") { + value = jsonUtil.getJsonValue(csInput, "default") + csInputMap.put(jsonUtil.getJsonValue(csInput, "name"), isBlank(value) ? 0 : (value as Integer)) + } else if (jsonUtil.getJsonValue(csInput, "type") == "string") { + csInputMap.put(jsonUtil.getJsonValue(csInput, "name"), + jsonUtil.getJsonValue(csInput, "default")) + } + } + csInputMap.put("expDataRateDL", expDataRateDL) + csInputMap.put("expDataRateUL", expDataRateUL) + csInputMap.put("latency", latency) + csInputMap.put("maxNumberofUEs", maxNumberOfUEs) + csInputMap.put("uEMobilityLevel", uEMobilityLevel) + csInputMap.put("resourceSharingLevel", resourceSharingLevel) + csInputMap.put("coverageAreaTAList", coverageArea) + csInputMap.put("useInterval", useInterval) + + execution.setVariable("csInputMap", csInputMap) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in CreateCommunicationService.parseCSParamsFromReq. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "parseCSParamsFromReq Exit") + } + + + /** + * get E2EST id through CST id and change communication profile to E2E service profile + * 1. get E2EST id from cst + * 1.1 查source service id + * 1.2 source service + * 1.3 source service input, init e2e profile + */ + def generateE2EServiceProfile = { DelegateExecution execution -> + logger.debug(Prefix + "generateE2EServiceProfile Start") + try { + ServiceDecomposition e2eServiceDecomposition = execution.getVariable( + "e2eServiceDecomposition") as ServiceDecomposition + String e2estTemplateInfo = e2eServiceDecomposition.getServiceInfo().getServiceProperties() + + List<String> e2eInputs = jsonUtil.StringArrayToList(e2estTemplateInfo) + + Map<String, ?> csInputMap = execution.getVariable("csInputMap") as Map + Map<String, ?> e2eInputMap = new HashMap<>() + String key + def value + + + for (String e2eInput in e2eInputs) { + if (jsonUtil.getJsonValue(e2eInput, "type") == "integer") { + def temp + key = jsonUtil.getJsonValue(e2eInput, "name") + value = csInputMap.containsKey(key) ? csInputMap.getOrDefault(key, 0) : (isBlank(temp = jsonUtil.getJsonValue(e2eInput, "default")) ? 0 : temp) + + e2eInputMap.put(key, value as Integer) + } else { + e2eInputMap.put(key = jsonUtil.getJsonValue(e2eInput, "name"), csInputMap.containsKey(key) + ? csInputMap.getOrDefault(key, null) : (jsonUtil.getJsonValue(e2eInput, "default"))) + } + } + + e2eInputMap.put("sNSSAI", execution.getVariable("sNSSAI_id")) + e2eInputMap.put("areaTrafficCapDL", 100) + e2eInputMap.put("areaTrafficCapUL", 100) + e2eInputMap.put("sST", execution.getVariable("csServiceType")) + + execution.setVariable("e2eInputMap", e2eInputMap) + execution.setVariable("e2eServiceType", e2eServiceDecomposition.getServiceType()) + execution.setVariable("e2eModelInvariantUuid", e2eServiceDecomposition.getModelInfo().getModelInvariantUuid()) + execution.setVariable("e2eModelUuid", e2eServiceDecomposition.getModelInfo().getModelUuid()) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in DoCreateE2EServiceInstance.createRelationShipInAAI. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + logger.debug(Prefix + "generateE2EServiceProfile Exit") + } + + + /** + * call createE2EService get operation id, + * created/processing + */ + def preRequestSend2NSMF(DelegateExecution execution) { + logger.debug(Prefix + "preRequestSend2NSMF Start") + try { + + //String NSMF_endpoint = "/onap/so/infra/e2eServiceInstances/v3" + def NSMF_endpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution) + def url = NSMF_endpoint + "/e2eServiceInstances/v3" + execution.setVariable("NSMF_endpoint", url) + //get from model catalog inputs + String payload = """ + { + "service":{ + "name": "${execution.getVariable("csServiceName")}", + "description": "e2eService of ${execution.getVariable("modelUuid")}", + "serviceInvariantUuid": "${execution.getVariable("e2eModelInvariantUuid")}", + "serviceUuid": "${execution.getVariable("e2eModelUuid")}", + "globalSubscriberId": "${execution.getVariable("globalSubscriberId")}", + "serviceType": "${execution.getVariable("subscriptionServiceType")}", + "parameters":{ + "requestInputs": ${execution.getVariable("e2eInputMap") as JSONObject} + } + } + } + """ + execution.setVariable("CSMF_NSMFRequest", payload.replaceAll("\\s+", "")) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in CreateCommunicationService.preRequestSend2NSMF. " + ex.getMessage() + logger.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + logger.debug(Prefix + "preRequestSend2NSMF Exit") + } + + + def processNSMFResponse = { DelegateExecution execution -> + logger.debug(Prefix + "processNSMFResponse Start") + //oof + try { + def CSMF_NSMFResponseCode = execution.getVariable("CSMF_NSMFResponseCode") as Integer + if (CSMF_NSMFResponseCode >= 200 && CSMF_NSMFResponseCode < 400) { + def CSMF_NSMFResponse = execution.getVariable("CSMF_NSMFResponse") as String + def e2eServiceInstanceId = jsonUtil.getJsonValue(CSMF_NSMFResponse, "service.serviceId") + def e2eOperationId = jsonUtil.getJsonValue(CSMF_NSMFResponse, "service.operationId") + + execution.setVariable("e2eServiceInstanceId", e2eServiceInstanceId) + execution.setVariable("e2eOperationId", e2eOperationId) + execution.setVariable("ProcessNsmfSuccess", "OK") + } else { + execution.setVariable("ProcessNsmfSuccess", "ERROR") + execution.setVariable("operationStatus", "error") + execution.setVariable("operationContent", + "communication service create operation error: nsmf response fail") + execution.setVariable("orchestrationStatus", "error") + } + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in " + Prefix + "processOOFResponse. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "processNSMFResponse Exit") + } + + + /** + * create communication service and e2e service relationship + * + */ + def createCSAndSSRelationship = { DelegateExecution execution -> + logger.debug(Prefix + "createCSAndSSRelationship Start") + String msg = "" + try { + def e2eServiceInstanceId = execution.getVariable("e2eServiceInstanceId") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + + Relationship relationship = new Relationship() + String relatedLink = "aai/v16/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${e2eServiceInstanceId}" + relationship.setRelatedLink(relatedLink) + + // create CS and SS relationship in AAI + createRelationShipInAAI(execution, relationship) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + + msg = "Exception in DoCreateE2EServiceInstance.createCustomRelationship. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "createCSAndSSRelationship Exit") + } + + + /** + * prepare update operation status to 50% after create relationship in aai + * @param execution + */ + def prepareUpdateOperationStatus = { DelegateExecution execution -> + logger.debug(Prefix + "prepareUpdateOperationStatus Start") + // update status creating + OperationStatus status = new OperationStatus() + status.setServiceId(execution.getVariable("serviceInstanceId") as String) + status.setOperationId(execution.getVariable("operationId") as String) + status.setOperation("CREATE") + status.setResult("processing") + status.setProgress("20") + status.setOperationContent("communication service create operation processing: waiting nsmf service create finished") + status.setUserId(execution.getVariable("globalSubscriberId") as String) + + requestDBUtil.prepareUpdateOperationStatus(execution, status) + logger.debug(Prefix + "prepareUpdateOperationStatus Exit") + } + + + /** + * create relationship in AAI + */ + private createRelationShipInAAI = { DelegateExecution execution, final Relationship relationship -> + logger.debug(Prefix + "createRelationShipInAAI Start") + String msg + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + execution.getVariable("globalSubscriberId"), + execution.getVariable("subscriptionServiceType"), + serviceInstanceId).relationshipAPI() + client.create(uri, relationship) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in CreateCommunicationService.createRelationShipInAAI. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "createRelationShipInAAI Exit") + + } + + + def 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", "CREATE") + + execution.setVariable("timeOut", 3 * 60 * 60 * 1000) + + def successParamMap = new HashMap<String, Object>() + successParamMap.put("orchestrationStatus", "deactivated") + + execution.setVariable("successParamMap", successParamMap) + + def errorParamMap = new HashMap<String, Object>() + errorParamMap.put("orchestrationStatus", "error") + + execution.setVariable("errorParamMap", errorParamMap) + + def timeOutParamMap = new HashMap<String, Object>() + timeOutParamMap.put("orchestrationStatus", "error") + + execution.setVariable("timeOutParamMap", timeOutParamMap) + + execution.setVariable("initProgress", 20) + execution.setVariable("endProgress", 90) + + logger.debug(Prefix + "prepareCallCheckProcessStatus Exit") + } + + + /** + * prepare update operation status to complete after NSMF process success + * @param execution + */ + def prepareCompleteStatus = { DelegateExecution execution -> + logger.debug(Prefix + "prepareCompleteStatus Start") + OperationStatus status = new OperationStatus() + status.setServiceId(execution.getVariable("serviceInstanceId") as String) + status.setOperationId(execution.getVariable("operationId") as String) + status.setOperation("CREATE") + status.setResult(execution.getVariable("operationStatus") as String) + status.setProgress("100") + status.setOperationContent(execution.getVariable("operationContent") as String) + status.setUserId(execution.getVariable("globalSubscriberId") as String) + + requestDBUtil.prepareUpdateOperationStatus(execution, status) + logger.debug("prepareCompleteStatus end, serviceInstanceId: " + execution.getVariable("serviceInstanceId") + + ", operationId: " + execution.getVariable("operationId")) + logger.debug(Prefix + "prepareCompleteStatus Exit") + } + + + /** + * update NSMF complete status to AAI when the NSMF process finished + * @param execution + */ + def updateFinishStatusInAAI = { DelegateExecution execution -> + logger.debug(Prefix + "updateFinishStatusInAAI Start") + String msg + try { + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String orchestrationStatus = execution.getVariable("orchestrationStatus") + // create service + ServiceInstance csi = new ServiceInstance() + csi.setOrchestrationStatus(orchestrationStatus) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalSubscriberId, subscriptionServiceType, serviceInstanceId) + client.update(uri, csi) + logger.debug(Prefix + "updateFinishStatusInAAI update communication service status to deactivated") + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in complete communication service " + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "updateFinishStatusInAAI Exit") + } + + + public sendSyncError = { DelegateExecution execution -> + logger.debug("sendSyncError Start") + try { + String errorMessage + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") as 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.debug("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + logger.debug(Prefix + "sendSyncError Exit") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy new file mode 100644 index 0000000000..7cc1a559c3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy @@ -0,0 +1,520 @@ +/*- + * ============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.bpmn.infrastructure.scripts + +import com.fasterxml.jackson.databind.ObjectMapper +import org.onap.aai.domain.yang.ServiceInstance +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.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory + +import javax.ws.rs.core.Response + +import static org.apache.commons.lang3.StringUtils.* +import org.springframework.web.util.UriUtils +import groovy.json.JsonSlurper +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.logging.filter.base.ONAPComponents +import org.onap.so.beans.nsmf.SliceTaskParams +import org.onap.so.db.request.beans.OrchestrationTask +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.OofUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.ErrorCode +import org.onap.so.logger.LoggingAnchor +import org.onap.so.logger.MessageEnum +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +public class CreateSliceService extends AbstractServiceTaskProcessor { + String Prefix = "CRESS_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + JsonSlurper jsonSlurper = new JsonSlurper() + ObjectMapper objectMapper = new ObjectMapper() + OofUtils oofUtils = new OofUtils() + private static final Logger logger = LoggerFactory.getLogger(CreateSliceService.class) + + + public void preProcessRequest(DelegateExecution execution) { + logger.debug("Start preProcessRequest") + execution.setVariable("prefix", Prefix) + String msg = "" + + try { + String ssRequest = execution.getVariable("bpmnRequest") + logger.debug(ssRequest) + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + logger.debug("Input Request:" + ssRequest + " reqId:" + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + serviceInstanceId = UUID.randomUUID().toString() + } + + String operationId = UUID.randomUUID().toString() + execution.setVariable("operationId", operationId) + + logger.debug("Generated new Service Instance:" + serviceInstanceId) + serviceInstanceId = UriUtils.encode(serviceInstanceId, "UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(ssRequest, "requestDetails.subscriberInfo.globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //requestInfo + execution.setVariable("source", jsonUtil.getJsonValue(ssRequest, "requestDetails.requestInfo.source")) + execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(ssRequest, "requestDetails.requestInfo.instanceName")) + execution.setVariable("disableRollback", jsonUtil.getJsonValue(ssRequest, "requestDetails.requestInfo.suppressRollback")) + String productFamilyId = jsonUtil.getJsonValue(ssRequest, "requestDetails.requestInfo.productFamilyId") + if (isBlank(productFamilyId)) { + msg = "Input productFamilyId is null" + logger.debug(msg) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("productFamilyId", productFamilyId) + } + + //modelInfo + String serviceModelInfo = jsonUtil.getJsonValue(ssRequest, "requestDetails.modelInfo") + if (isBlank(serviceModelInfo)) { + msg = "Input serviceModelInfo is null" + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("serviceModelInfo", serviceModelInfo) + } + + logger.debug("modelInfo: " + serviceModelInfo) + + //requestParameters + String subscriptionServiceType = jsonUtil.getJsonValue(ssRequest, "requestDetails.requestParameters.subscriptionServiceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + } + logger.debug("subscriptionServiceType: " + subscriptionServiceType) + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + Map reqMap = jsonSlurper.parseText(ssRequest) + + //InputParams + def userParamsList = reqMap.requestDetails?.requestParameters?.userParams + + Map<String, String> inputMap = [:] + if (userParamsList) { + for (def i = 0; i < userParamsList.size(); i++) { + def userParams1 = userParamsList.get(i) + userParams1.each { param -> inputMap.put(param.key, param.value) } + } + } + + logger.debug("User Input Parameters map: " + inputMap.toString()) + String uuiRequest = inputMap.get("UUIRequest") + Map uuiReqMap = jsonSlurper.parseText(uuiRequest) + Map<String, Object> serviceObject = (Map<String, Object>) uuiReqMap.get("service") + Map<String, Object> parameterObject = (Map<String, Object>) serviceObject.get("parameters") + Map<String, Object> requestInputs = (Map<String, Object>) parameterObject.get("requestInputs") + + execution.setVariable("serviceInputParams", inputMap) + execution.setVariable("uuiRequest", uuiRequest) + execution.setVariable("serviceProfile", requestInputs) + + //TODO + //execution.setVariable("serviceInputParams", jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams")) + //execution.setVariable("failExists", true) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in preProcessRequest " + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug("Finish preProcessRequest") + } + + public void getNSTSelection(DelegateExecution execution) { + logger.debug("Start getNSTSelection") + String requestId = execution.getVariable("msoRequestId") + Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") + String oofUrl = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) + + def authHeader = "" + String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution) + String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution) + + String basicAuthValue = utils.encrypt(basicAuth, msokey) + if (basicAuthValue != null) { + logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue) + try { + authHeader = utils.getBasicAuth(basicAuthValue, msokey) + execution.setVariable("BasicAuthHeaderValue", authHeader) + } catch (Exception ex) { + logger.debug( "Unable to encode username and password string: " + ex) + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " + + "encode username and password string") + } + } else { + logger.debug( "Unable to obtain BasicAuth - BasicAuth value null") + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " + + "value null") + } + + URL requestUrl = new URL(oofUrl + "/api/oof/v1/selection/nst") + String oofRequest = oofUtils.buildSelectNSTRequest(requestId, serviceProfile) + HttpClient httpClient = new HttpClientFactory().newJsonClient(requestUrl, ONAPComponents.OOF) + httpClient.addAdditionalHeader("Authorization", authHeader) + Response httpResponse = httpClient.post(oofRequest) + + int responseCode = httpResponse.getStatus() + logger.debug("OOF sync response code is: " + responseCode) + + if(responseCode != 200){ + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.") + } + + Map<String, Object> nstSolution + try { + Map<String, Object> resMap = httpResponse.readEntity(Map.class) + List<Map<String, Object>> nstSolutions = (List<Map<String, Object>>) resMap.get("solutions") + nstSolution = nstSolutions.get(0) + execution.setVariable("nstSolution", nstSolution) + } catch (Exception ex) { + logger.debug( "Failed to get NST solution suggested by OOF.") + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Failed to get NST solution suggested by OOF.") + } + + logger.debug("Finish getNSTSelection") + + } + + public void prepareDecomposeService(DelegateExecution execution) { + logger.debug("Start prepareDecomposeService") + String uuiRequest = execution.getVariable("uuiRequest") + String ssModelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid") + String ssModelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid") + String ssServiceModelInfo = """{ + "modelInvariantUuid":"${ssModelInvariantUuid}", + "modelUuid":"${ssModelUuid}", + "modelVersion":"" + }""" + execution.setVariable("ssServiceModelInfo", ssServiceModelInfo) + + logger.debug("Finish prepareDecomposeService") + } + + public void processDecomposition(DelegateExecution execution) { + logger.debug("Start processDecomposition") + String uuiRequest = execution.getVariable("uuiRequest") + Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") + Map<String, Object> nstSolution = execution.getVariable("nstSolution") + + Map uuiReqMap = jsonSlurper.parseText(uuiRequest) + Map<String, Object> serviceObject = (Map<String, Object>) uuiReqMap.get("service") + String subscriptionServiceType = serviceObject.get("serviceType") + + String serviceType = (String) serviceProfile.get("sST") + String resourceSharingLevel = (String) serviceProfile.get("resourceSharingLevel") + String nstModelUuid = (String) nstSolution.get("UUID") + String nstModelInvariantUuid = (String) nstSolution.get("invariantUUID") + + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + execution.setVariable("serviceType", serviceType) + execution.setVariable("resourceSharingLevel", resourceSharingLevel) + execution.setVariable("nstModelUuid", nstModelUuid) + execution.setVariable("nstModelInvariantUuid", nstModelInvariantUuid) + + logger.debug("Finish processDecomposition") + } + + public void prepareCreateOrchestrationTask(DelegateExecution execution) { + logger.debug("Start createOrchestrationTask") + String taskId = execution.getBusinessKey() + execution.setVariable("orchestrationTaskId", taskId) + logger.debug("BusinessKey: " + taskId) + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String serviceInstanceName = execution.getVariable("serviceInstanceName") + String taskName = "SliceServiceTask" + String taskStatus = "Planning" + String isManual = "false" + String requestMethod = "POST" + execution.setVariable("CSSOT_taskId", taskId) + execution.setVariable("CSSOT_name", taskName) + execution.setVariable("CSSOT_status", taskStatus) + execution.setVariable("CSSOT_isManual", isManual) + execution.setVariable("CSSOT_requestMethod", requestMethod) + + Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") + Map<String, Object> sliceProfileTn = execution.getVariable("sliceProfileTn") + Map<String, Object> sliceProfileCn = execution.getVariable("sliceProfileCn") + Map<String, Object> sliceProfileAn = execution.getVariable("sliceProfileAn") + + SliceTaskParams sliceTaskParams = new SliceTaskParams() + sliceTaskParams.setServiceId(serviceInstanceId) + sliceTaskParams.setServiceName(serviceInstanceName) + sliceTaskParams.setServiceProfile(serviceProfile) + sliceTaskParams.setSliceProfileTn(sliceProfileTn) + sliceTaskParams.setSliceProfileCn(sliceProfileCn) + sliceTaskParams.setSliceProfileAn(sliceProfileAn) + execution.setVariable("sliceTaskParams", sliceTaskParams) + + String paramJson = sliceTaskParams.convertToJson() + execution.setVariable("CSSOT_paramJson", paramJson) + logger.debug("CSSOT_paramJson: " + paramJson) + + logger.debug("Finish createOrchestrationTask") + } + + public void prepareUpdateOrchestrationTask(DelegateExecution execution) { + logger.debug("Start prepareUpdateOrchestrationTask") + String requestMethod = "PUT" + String taskStatus = execution.getVariable("taskStatus") + SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") + String paramJson = sliceTaskParams.convertToJson() + execution.setVariable("CSSOT_status", taskStatus) + execution.setVariable("CSSOT_paramJson", paramJson) + execution.setVariable("CSSOT_requestMethod", requestMethod) + logger.debug("Finish prepareUpdateOrchestrationTask") + } + + public void prepareGetUserOptions(DelegateExecution execution) { + logger.debug("Start prepareGetUserOptions") + String requestMethod = "GET" + execution.setVariable("taskAction", "commit") + String taskAction = execution.getVariable("taskAction") + logger.debug("task action is: " + taskAction) + if (!"commit".equals(taskAction) && !"abort".equals(taskAction)) { + String msg = "Unknown task action: " + taskAction + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("CSSOT_requestMethod", requestMethod) + logger.debug("Finish prepareGetUserOptions") + } + + public void processUserOptions(DelegateExecution execution) { + logger.debug("Start processUserOptions") + String response = execution.getVariable("CSSOT_dbResponse") + OrchestrationTask orchestrationTask = objectMapper.readValue(response, OrchestrationTask.class) + String paramJson = orchestrationTask.getParams() + logger.debug("paramJson: " + paramJson) + SliceTaskParams sliceTaskParams = new SliceTaskParams() + sliceTaskParams.convertFromJson(paramJson) + execution.setVariable("sliceTaskParams", sliceTaskParams) + logger.debug("Finish processUserOptions") + } + + public void updateAAIOrchStatus(DelegateExecution execution) { + logger.debug("Start updateAAIOrchStatus") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String orchStatus = execution.getVariable("orchestrationStatus") + + try { + ServiceInstance si = execution.getVariable("serviceInstanceData") + si.setOrchestrationStatus(orchStatus) + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + client.update(uri, si) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in CreateSliceService.updateAAIOrchStatus " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + logger.debug("Finish updateAAIOrchStatus") + } + + public void prepareInitServiceOperationStatus(DelegateExecution execution) { + logger.debug("Start prepareInitServiceOperationStatus") + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = "CREATE" + String userId = execution.getVariable("globalSubscriberId") + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service creation" + logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationType", operationType) + + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint",execution) + execution.setVariable("CSSOS_dbAdapterEndpoint", dbAdapterEndpoint) + logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint) + def dbAdapterAuth = UrnPropertiesReader.getVariable("mso.requestDb.auth") + Map<String, String> CSSOS_headerMap = [:] + CSSOS_headerMap.put("content-type", "application/soap+xml") + CSSOS_headerMap.put("Authorization", dbAdapterAuth) + execution.setVariable("CSSOS_headerMap", CSSOS_headerMap) + logger.debug("DB Adapter Header is: " + CSSOS_headerMap) + + String payload = + """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:initServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb"> + <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId> + <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> + <operationType>${MsoUtils.xmlEscape(operationType)}</operationType> + <userId>${MsoUtils.xmlEscape(userId)}</userId> + <result>${MsoUtils.xmlEscape(result)}</result> + <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent> + <progress>${MsoUtils.xmlEscape(progress)}</progress> + <reason>${MsoUtils.xmlEscape(reason)}</reason> + </ns:initServiceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + payload = utils.formatXml(payload) + execution.setVariable("CSSOS_updateServiceOperStatusRequest", payload) + logger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload) + }catch(Exception e){ + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) + } + logger.debug("Finish prepareInitServiceOperationStatus") + } + + public void prepareUpdateServiceOperationStatus(DelegateExecution execution) { + logger.debug("Start preUpdateServiceOperationStatus") + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = execution.getVariable("operationType") + String userId = execution.getVariable("globalSubscriberId") + String result = execution.getVariable("operationResult") + String progress = execution.getVariable("operationProgress") + String reason = execution.getVariable("operationReason") + String operationContent = "service: " + result + " progress: " + progress + + String payload = + """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:initServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb"> + <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId> + <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> + <operationType>${MsoUtils.xmlEscape(operationType)}</operationType> + <userId>${MsoUtils.xmlEscape(userId)}</userId> + <result>${MsoUtils.xmlEscape(result)}</result> + <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent> + <progress>${MsoUtils.xmlEscape(progress)}</progress> + <reason>${MsoUtils.xmlEscape(reason)}</reason> + </ns:initServiceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + payload = utils.formatXml(payload) + execution.setVariable("CSSOS_updateServiceOperStatusRequest", payload) + logger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload) + + }catch(Exception e){ + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preUpdateServiceOperationStatus.", "BPMN", + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e.getMessage()) + } + logger.debug("Finish preUpdateServiceOperationStatus") + } + + public void sendSyncResponse(DelegateExecution execution) { + logger.debug("Start sendSyncResponse") + try { + String operationId = execution.getVariable("operationId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + // RESTResponse for API Handler (APIH) Reply Task + String createServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${operationId}"}}""".trim() + logger.debug("sendSyncResponse to APIH:" + "\n" + createServiceRestRequest) + sendWorkflowResponse(execution, 202, createServiceRestRequest) + execution.setVariable("sentSyncResponse", true) + } catch (Exception e) { + String msg = "Exceptuion in sendSyncResponse:" + e.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug("Finish sendSyncResponse") + } + + public void prepareCompletionRequest (DelegateExecution execution) { + logger.trace("Start prepareCompletionRequest") + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String source = execution.getVariable("source") + + String msoCompletionRequest = + """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:ns="http://org.onap/so/request/types/v1"> + <request-info xmlns="http://org.onap/so/infra/vnf-request/v1"> + <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> + <action>CREATE</action> + <source>${MsoUtils.xmlEscape(source)}</source> + </request-info> + <status-message>Service Instance was created successfully.</status-message> + <serviceInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</serviceInstanceId> + <mso-bpel-name>CreateGenericALaCarteServiceInstance</mso-bpel-name> + </aetgt:MsoCompletionRequest>""" + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable("completionRequest", xmlMsoCompletionRequest) + logger.debug("Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.trace("Finish prepareCompletionRequest") + } + +} + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationServiceTest.groovy new file mode 100644 index 0000000000..3622cc0062 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationServiceTest.groovy @@ -0,0 +1,456 @@ +/*- + * ============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.impl.persistence.entity.ExecutionEntity +import org.json.JSONObject +import org.junit.Before +import org.junit.Test +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.onap.so.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceInfo +import org.onap.so.bpmn.core.domain.ServiceProxy + +import static org.junit.Assert.assertEquals +import static org.junit.Assert.assertNotNull +import static org.mockito.ArgumentMatchers.eq +import static org.mockito.Mockito.times +import static org.mockito.Mockito.when + +class CreateCommunicationServiceTest extends MsoGroovyTest { + + @Before + void init() throws IOException { + super.init("CreateCommunicationService") + } + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Test + void testPreProcessRequest() { + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(""" + { + "requestDetails": { + "modelInfo": { + "modelInvariantId": "e75698d9-925a-4cdd-a6c0-edacbe6a0b51", + "modelType": "service", + "modelNameVersionId": "8ee5926d-720b-4bb2-86f9-d20e921c143b", + "modelName": "voLTE", + "modelVersion": "1.0", + "modelVersionId": "8ee5926d-720b-4bb2-86f9-d20e921c143b", + "modelUuid": "8ee5926d-720b-4bb2-86f9-d20e921c143b", + "modelInvariantUuid": "e75698d9-925a-4cdd-a6c0-edacbe6a0b51" + }, + "requestInfo": { + "source": "UUI", + "instanceName": "CSMFService", + "suppressRollback": true + }, + "subscriberInfo": { + "globalSubscriberId": "5GCustomer" + }, + "requestParameters": { + "subscriptionServiceType": "MOG", + "userParams": [{ + "ServiceInstanceName": "CSMFService", + "UUIRequest": "{\\r\\n \\ + "service\\":{\\r\\n \\"name\\":\\"CSMFService\\",\\r\\n + \\"description\\":\\"CSMFService\\",\\r\\n + \\"serviceInvariantUuid\\":\\"e75698d9-925a-4cdd-a6c0-edacbe6a0b51\\",\\r\\n + \\"serviceUuid\\":\\"8ee5926d-720b-4bb2-86f9-d20e921c143b\\",\\r\\n + \\"globalSubscriberId\\":\\"5GCustomer\\",\\r\\n + \\"serviceType\\":\\"5G\\",\\r\\n + \\"parameters\\":{\\r\\n + \\"requestInputs\\":{\\r\\n + \\"expDataRateDL\\":10,\\r\\n + \\"expDataRateUL\\":30,\\r\\n + \\"latency\\":20,\\r\\n + \\"maxNumberofUEs\\":300,\\r\\n + \\"uemobilityLevel\\":\\"stationary\\",\\r\\n + \\"resourceSharingLevel\\":\\"shared\\",\\r\\n + \\"coverageAreaList\\": \\"01001\\",\\r\\n + \\"useInterval\\":\\"3\\"\\r\\n + }\\r\\n + }\\r\\n }\\r\\n}\\r\\n" + }], + "aLaCarte": true, + "usePreload": true + } + }, + "serviceInstanceId": null, + "vnfInstanceId": null, + "networkInstanceId": null, + "volumeGroupInstanceId": null, + "vfModuleInstanceId": null, + "configurationId": null, + "instanceGroupId": null + }""".replaceAll("\\s+", "")) + when(mockExecution.getVariable("mso-request-id")).thenReturn("edb08d97-e0f9-4c71-840a-72080d7be42e") + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.preProcessRequest(mockExecution) + Mockito.verify(mockExecution, times(14)).setVariable(captor.capture() as String, captor.capture()) + List<ExecutionEntity> values = captor.getAllValues() + assertNotNull(values) + } + + @Test + void testPrepareInitOperationStatus() { + + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("operationId")).thenReturn("54321") + + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111") + + CreateCommunicationService communicationService = new CreateCommunicationService() + + communicationService.prepareInitOperationStatus(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String res = captor.getValue() + assertNotNull(res) + } + + + @Test + void testSendSyncResponse() { + when(mockExecution.getVariable("operationId")).thenReturn("123456") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.sendSyncResponse(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("sentSyncResponse"), captor.capture()) + def updateVolumeGroupRequest = captor.getValue() + assertEquals(updateVolumeGroupRequest, true) + } + + + @Test + void testPrepareDoComposeE2E() { + ServiceDecomposition serviceDecomposition = new ServiceDecomposition() + ServiceProxy serviceProxy = new ServiceProxy() + serviceProxy.setSourceModelUuid("f2f5967e-72d3-4c5c-b880-e214e71dba4e") + serviceDecomposition.setServiceProxy(Arrays.asList(serviceProxy)) + when(mockExecution.getVariable("csServiceDecomposition")).thenReturn(serviceDecomposition) + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.prepareDoComposeE2E(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("e2eServiceModelInfo"), captor.capture()) + String e2eServiceModelInfo = captor.getValue() + assertEquals(e2eServiceModelInfo.trim().replaceAll(" ", ""), + """{"modelUuid":"f2f5967e-72d3-4c5c-b880-e214e71dba4e"}""") + } + + @Test + void testParseCSParamsFromReq() { + mockData() + when(mockExecution.getVariable("csServiceModelInfo")).thenReturn(""" + { + "modelInvariantUuid":"e75698d9-925a-4cdd-a6c0-edacbe6a0b51", + "modelName":"voLTE", + "modelNameVersionId":"8ee5926d-720b-4bb2-86f9-d20e921c143b", + "modelVersion":"1.0", + "modelVersionId":"8ee5926d-720b-4bb2-86f9-d20e921c143b", + "modelInvariantId":"e75698d9-925a-4cdd-a6c0-edacbe6a0b51", + "modelType":"service", + "modelUuid":"8ee5926d-720b-4bb2-86f9-d20e921c143b" + }""") + + ServiceDecomposition decomposition = new ServiceDecomposition() + decomposition.setServiceType("embb") + ServiceInfo serviceInfo = new ServiceInfo() + serviceInfo.setServiceProperties(""" + [{"name":"useInterval","type":"string","required":false}, + {"default":"39-00","name":"plmnIdList","type":"string","required":false}, + {"name":"maxNumberofUEs","type":"integer","required":false}, + {"name":"latency","type":"integer","required":false}, + {"name":"uEMobilityLevel","type":"string","required":false}, + {"name":"expDataRateUL","type":"integer","required":false}, + {"name":"expDataRateDL","type":"integer","required":false}, + {"name":"coverageAreaList","type":"string","required":false}, + {"name":"sNSSAI","type":"string","required":false}, + {"name":"resourceSharingLevel","type":"string","required":false}] + """) + decomposition.setServiceInfo(serviceInfo) + + when(mockExecution.getVariable("csServiceDecomposition")).thenReturn(decomposition) + + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.parseCSParamsFromReq(mockExecution) + + Mockito.verify(mockExecution, times(1)).setVariable(eq("csInputMap"), captor.capture()) + def csInputMap = captor.getValue() + assertEquals(getExpectCsInputMap(), csInputMap) + + } + + private static Map<String, Object> getExpectCsInputMap() { + Map<String, Object> csInputMap = new HashMap<>() + csInputMap.put("expDataRateDL", 10) + csInputMap.put("expDataRateUL", 30) + csInputMap.put("latency", 20) + csInputMap.put("maxNumberofUEs", 300) + csInputMap.put("uEMobilityLevel", "stationary") + csInputMap.put("resourceSharingLevel", "shared") + csInputMap.put("coverageAreaTAList", "01001") + csInputMap.put("useInterval", "3") + csInputMap.put("coverageAreaList", null) + csInputMap.put("plmnIdList", "39-00") + csInputMap.put("sNSSAI", null) + return csInputMap + } + + @Test + void testGenerateE2EServiceProfile() { + ServiceDecomposition decomposition = new ServiceDecomposition() + decomposition.setServiceType("embb") + ServiceInfo serviceInfo = new ServiceInfo() + serviceInfo.setServiceProperties(""" + [{"name":"nstar0_allottedresource0_providing_service_uuid","type":"string","required":true}, + {"name":"areaTrafficCapDL","type":"integer","required":false}, + {"name":"maxNumberofUEs","type":"integer","required":false}, + {"name":"latency","type":"integer","required":false}, + {"name":"expDataRateUL","type":"integer","required":false}, + {"name":"sNSSAI","type":"string","required":false}, + {"name":"plmnIdList","type":"string","required":false}, + {"name":"sST","type":"integer","required":false}, + {"name":"areaTrafficCapUL","type":"integer","required":false}, + {"name":"uEMobilityLevel","type":"string","required":false}, + {"name":"expDataRateDL","type":"integer","required":false}, + {"name":"nstar0_allottedresource0_providing_service_invariant_uuid","type":"string","required":true}, + {"name":"coverageAreaTAList","type":"string","required":false}, + {"name":"activityFactor","type":"integer","required":false}, + {"name":"resourceSharingLevel","type":"string","required":false}] + """) + decomposition.setServiceInfo(serviceInfo) + + ModelInfo modelInfo = new ModelInfo() + modelInfo.setModelInvariantUuid("e75698d9-925a-4cdd-a6c0-edacbe6a0b51") + modelInfo.setModelUuid("8ee5926d-720b-4bb2-86f9-d20e921c143b") + decomposition.setModelInfo(modelInfo) + + when(mockExecution.getVariable("e2eServiceDecomposition")).thenReturn(decomposition) + when(mockExecution.getVariable("csInputMap")).thenReturn(getExpectCsInputMap()) + + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.generateE2EServiceProfile(mockExecution) + + Mockito.verify(mockExecution, times(1)).setVariable(eq("e2eInputMap"), captor.capture()) + def csInputMap = captor.getValue() + assertEquals(csInputMap, getExpectE2eInputMap()) + } + + private static Map<String, Object> getExpectE2eInputMap() { + Map<String, Object> e2eInputMap = new HashMap<>() + e2eInputMap.put("nstar0_allottedresource0_providing_service_uuid", null) + e2eInputMap.put("nstar0_allottedresource0_providing_service_invariant_uuid", null) + e2eInputMap.put("areaTrafficCapDL", 100) + e2eInputMap.put("areaTrafficCapUL", 100) + e2eInputMap.put("expDataRateDL", 10) + e2eInputMap.put("expDataRateUL", 30) + e2eInputMap.put("latency", 20) + e2eInputMap.put("maxNumberofUEs", 300) + e2eInputMap.put("uEMobilityLevel", "stationary") + e2eInputMap.put("resourceSharingLevel", "shared") + e2eInputMap.put("coverageAreaTAList", "01001") + e2eInputMap.put("sST", null) + e2eInputMap.put("activityFactor", 0) + e2eInputMap.put("plmnIdList", "39-00") + e2eInputMap.put("sNSSAI", null) + + return e2eInputMap + } + + @Test + void testPreRequestSend2NSMF() { + when(mockExecution.getVariable("e2eInputMap")).thenReturn(getExpectE2eInputMap()) + when(mockExecution.getVariable("csServiceName")).thenReturn("testName") + when(mockExecution.getVariable("modelUuid")).thenReturn("12345") + when(mockExecution.getVariable("e2eModelInvariantUuid")).thenReturn("54321") + when(mockExecution.getVariable("e2eModelUuid")).thenReturn("11111") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("test111") + when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5GConsumer") + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.preRequestSend2NSMF(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("CSMF_NSMFRequest"), captor.capture()) + String resultSuccess = captor.getValue() + + def expectMap = getExpectE2eInputMap() + expectMap.put("nstar0_allottedresource0_providing_service_uuid", null) + expectMap.put("nstar0_allottedresource0_providing_service_invariant_uuid", null) + + String expect = """ + { + "service":{ + "name": "testName", + "description": "e2eService of 12345", + "serviceInvariantUuid": "54321", + "serviceUuid": "11111", + "globalSubscriberId": "test111", + "serviceType": "5GConsumer", + "parameters":{ + "requestInputs": ${expectMap as JSONObject} + } + } + } + """ + assertEquals(expect.replaceAll("\\s+", ""), resultSuccess.replaceAll("\\s+", "")) + } + + @Test + void testProcessNSMFResponseSuccess() { + when(mockExecution.getVariable("CSMF_NSMFResponseCode")).thenReturn(202) + when(mockExecution.getVariable("CSMF_NSMFResponse")).thenReturn(""" + { + "service": { + "serviceId": "945063ff-1a01-4944-9232-8e7999e0d5e4", + "operationId": "e3819a23-3777-4172-a834-35ee78acf3f4" + } + } + """) + + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.processNSMFResponse(mockExecution) + Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture()) + def resultSuccess = captor.getAllValues() + + def expect = new ArrayList<>() + expect.add("e2eServiceInstanceId") + expect.add("945063ff-1a01-4944-9232-8e7999e0d5e4") + expect.add("e2eOperationId") + expect.add("e3819a23-3777-4172-a834-35ee78acf3f4") + expect.add("ProcessNsmfSuccess") + expect.add("OK") + assertEquals(expect, resultSuccess) + } + + @Test + void testProcessNSMFResponseError() { + when(mockExecution.getVariable("CSMF_NSMFResponseCode")).thenReturn(500) + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.processNSMFResponse(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("ProcessNsmfSuccess"), captor.capture()) + String resultSuccess = captor.getValue() + assertEquals("ERROR", resultSuccess) + } + + @Test + void testPrepareUpdateOperationStatus() { + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("operationId")).thenReturn("54321") + + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111") + when(mockExecution.getVariable("mso.adapters.openecomp.db.endpoint")) + .thenReturn("http://localhost:28090/dbadapters/RequestsDbAdapter") + CreateCommunicationService communicationService = new CreateCommunicationService() + + communicationService.prepareUpdateOperationStatus(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String res = captor.getValue() + + String expect = getExpectPayload("updateServiceOperationStatus", "processing", "20", + "communication service create operation processing: waiting nsmf service create finished") + + assertEquals(expect.replaceAll("\\s+", ""), res.replaceAll("\\s+", "")) + } + + + @Test + void testPrepareCallCheckProcessStatus() { + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.prepareCallCheckProcessStatus(mockExecution) + Mockito.verify(mockExecution, times(10)).setVariable(captor.capture(), captor.capture()) + def resultSuccess = captor.getAllValues() + assertNotNull(resultSuccess) + } + + + @Test + void testPrepareCompleteStatus() { + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("operationId")).thenReturn("54321") + when(mockExecution.getVariable("operationContent")) + .thenReturn("communication service create operation finished") + + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111") + when(mockExecution.getVariable("operationStatus")) + .thenReturn("processing") + CreateCommunicationService communicationService = new CreateCommunicationService() + + communicationService.prepareCompleteStatus(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String res = captor.getValue() + + String expect = getExpectPayload("updateServiceOperationStatus", "processing", "100", + "communication service create operation finished") + + assertEquals(expect.replaceAll("\\s+", ""), res.replaceAll("\\s+", "")) + } + + private static String getExpectPayload(String type, String result, String progress, String operationContent) { + String expect = + """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:${type} xmlns:ns="http://org.onap.so/requestsdb"> + <serviceId>12345</serviceId> + <operationId>54321</operationId> + <operationType>CREATE</operationType> + <userId>11111</userId> + <result>${result}</result> + <operationContent>${operationContent}</operationContent> + <progress>${progress}</progress> + <reason></reason> + </ns:${type}> + </soapenv:Body> + </soapenv:Envelope> + """ + return expect + } + + private void mockData() { + when(mockExecution.getVariable("uuiRequest")).thenReturn("""{ + "service":{ + "name":"CSMFService", + "description":"CSMFService", + "serviceInvariantUuid":"e75698d9-925a-4cdd-a6c0-edacbe6a0b51", + "serviceUuid":"8ee5926d-720b-4bb2-86f9-d20e921c143b", + "globalSubscriberId":"5GCustomer", + "serviceType":"5G", + "parameters":{ + "requestInputs":{ + "expDataRateDL":10, + "expDataRateUL":30, + "latency":20, + "maxNumberofUEs":300, + "uemobilityLevel":"stationary", + "resourceSharingLevel":"shared", + "coverageAreaList": "01001", + "useInterval":"3" + } + } + } + }""") + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceService.bpmn new file mode 100644 index 0000000000..cd4cf473a6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceService.bpmn @@ -0,0 +1,372 @@ +<?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_13dsy4w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> + <bpmn:error id="Error_0l3pcnc" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> + <bpmn:error id="Error_1eyu7sx" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> + <bpmn:collaboration id="Collaboration_0htncd8"> + <bpmn:participant id="ActivateSliceService01" name="ActivateSliceService" processRef="ActivateSliceService" /> + </bpmn:collaboration> + <bpmn:process id="ActivateSliceService" name="ActivateSliceService" isExecutable="true"> + <bpmn:scriptTask id="Task_1vscxgp" name="Update the status of SNSSAI and NSI and NSSI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1jp9gjt</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1gkpl5q</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.updateStatusSNSSAIandNSIandNSSI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_0cbth6k" name="Prepare Completion Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1gkpl5q</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0pzts4p</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new ActivateSliceService() +csi.prepareCompletionRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_1aymwlt" 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_0pzts4p</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ozefu5</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:endEvent id="EndEvent_0d1g3mv"> + <bpmn:incoming>SequenceFlow_0r611x8</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0ozefu5</bpmn:incoming> + </bpmn:endEvent> + <bpmn:endEvent id="EndEvent_1pujgw8"> + <bpmn:incoming>SequenceFlow_1qa8miv</bpmn:incoming> + <bpmn:errorEventDefinition id="ErrorEventDefinition_17jklyl" errorRef="Error_1eyu7sx" /> + </bpmn:endEvent> + <bpmn:exclusiveGateway id="ExclusiveGateway_0z7s0nx" name="IsSuccessfull"> + <bpmn:incoming>SequenceFlow_00ba5l9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1jp9gjt</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1qa8miv</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:callActivity id="CallActivity_1cvb0iq" name="Send command NSSMF" calledElement="DoSendCommandToNSSMF"> + <bpmn:extensionElements> + <camunda:in source="nssiMap" target="nssiMap" /> + <camunda:in source="operationType" target="operationType" /> + <camunda:in source="NSIserviceid" target="NSIserviceid" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:out source="isNSSIActivate" target="isNSSIActivate" /> + <camunda:in source="snssai" target="snssai" /> + <camunda:in source="e2eserviceInstanceId" target="e2eserviceInstanceId" /> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="activationCount" target="activationCount" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1o4zjvp</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_00ba5l9</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_04p0zjj" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1yus0c1</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1uqgdxr</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new ActivateSliceService() +csi.sendSyncResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_1o8fe1v" name="check AAI Orch Status of slice" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1uqgdxr</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_149lhmo</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.checkAAIOrchStatusofslice(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_0fcc3uy" name="Success?"> + <bpmn:incoming>SequenceFlow_149lhmo</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15fdf5d</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0r611x8</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:scriptTask id="Task_08zavab" name="PrepareActiviation" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_15fdf5d</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_144cqr9</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.prepareActivation(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="Task_18urz3r" 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="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_1av6du3</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1yus0c1</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:scriptTask id="Task_1ossedo" name="Pre Process Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0qksr1g</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_183ypky</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_1g8cg9g" name="Any NSSI to activate?"> + <bpmn:incoming>SequenceFlow_144cqr9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1o4zjvp</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1pj1j1o</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:startEvent id="StartEvent_1"> + <bpmn:outgoing>SequenceFlow_0qksr1g</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_1taw2p9"> + <bpmn:incoming>SequenceFlow_1pj1j1o</bpmn:incoming> + <bpmn:errorEventDefinition id="ErrorEventDefinition_03iwehr" errorRef="Error_0l3pcnc" /> + </bpmn:endEvent> + <bpmn:scriptTask id="Task_13zoo6a" name="Init Service Operation Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_183ypky</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1av6du3</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.prepareInitServiceOperationStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:subProcess id="SubProcess_0iljxjd" name="sub process for fallouthandler and rollback" triggeredByEvent="true"> + <bpmn:scriptTask id="Task_01ooik6" name="Send Error Response"> + <bpmn:incoming>SequenceFlow_0oiiwjo</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0uckyao</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.sendSyncError(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:endEvent id="EndEvent_1wd8iqk"> + <bpmn:incoming>SequenceFlow_0uckyao</bpmn:incoming> + </bpmn:endEvent> + <bpmn:startEvent id="StartEvent_0hmwdqq"> + <bpmn:outgoing>SequenceFlow_0oiiwjo</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_1il80ww" /> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_0oiiwjo" sourceRef="StartEvent_0hmwdqq" targetRef="Task_01ooik6" /> + <bpmn:sequenceFlow id="SequenceFlow_0uckyao" sourceRef="Task_01ooik6" targetRef="EndEvent_1wd8iqk" /> + </bpmn:subProcess> + <bpmn:sequenceFlow id="SequenceFlow_1av6du3" sourceRef="Task_13zoo6a" targetRef="Task_18urz3r" /> + <bpmn:sequenceFlow id="SequenceFlow_1pj1j1o" name="no" sourceRef="ExclusiveGateway_1g8cg9g" targetRef="EndEvent_1taw2p9"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivate") == "false"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0r611x8" name="NO" sourceRef="ExclusiveGateway_0fcc3uy" targetRef="EndEvent_0d1g3mv"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isContinue") == "false"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1qa8miv" name="no" sourceRef="ExclusiveGateway_0z7s0nx" targetRef="EndEvent_1pujgw8"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivate") == "false"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1jp9gjt" name="yes" sourceRef="ExclusiveGateway_0z7s0nx" targetRef="Task_1vscxgp"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivate") == "true"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_00ba5l9" sourceRef="CallActivity_1cvb0iq" targetRef="ExclusiveGateway_0z7s0nx" /> + <bpmn:sequenceFlow id="SequenceFlow_1uqgdxr" sourceRef="ScriptTask_04p0zjj" targetRef="Task_1o8fe1v" /> + <bpmn:sequenceFlow id="SequenceFlow_0qksr1g" sourceRef="StartEvent_1" targetRef="Task_1ossedo" /> + <bpmn:sequenceFlow id="SequenceFlow_183ypky" sourceRef="Task_1ossedo" targetRef="Task_13zoo6a" /> + <bpmn:sequenceFlow id="SequenceFlow_1yus0c1" sourceRef="Task_18urz3r" targetRef="ScriptTask_04p0zjj" /> + <bpmn:sequenceFlow id="SequenceFlow_149lhmo" sourceRef="Task_1o8fe1v" targetRef="ExclusiveGateway_0fcc3uy" /> + <bpmn:sequenceFlow id="SequenceFlow_15fdf5d" name="yes" sourceRef="ExclusiveGateway_0fcc3uy" targetRef="Task_08zavab"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isContinue") == "true"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_144cqr9" sourceRef="Task_08zavab" targetRef="ExclusiveGateway_1g8cg9g" /> + <bpmn:sequenceFlow id="SequenceFlow_1o4zjvp" name="yes" sourceRef="ExclusiveGateway_1g8cg9g" targetRef="CallActivity_1cvb0iq"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivate") == "true"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1gkpl5q" sourceRef="Task_1vscxgp" targetRef="ScriptTask_0cbth6k" /> + <bpmn:sequenceFlow id="SequenceFlow_0pzts4p" sourceRef="ScriptTask_0cbth6k" targetRef="ServiceTask_1aymwlt" /> + <bpmn:sequenceFlow id="SequenceFlow_0ozefu5" sourceRef="ServiceTask_1aymwlt" targetRef="EndEvent_0d1g3mv" /> + </bpmn:process> + <bpmn:error id="Error_0vq6f5h" name="Error_3ai5jm1" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0htncd8"> + <bpmndi:BPMNShape id="Participant_1x12pgg_di" bpmnElement="ActivateSliceService01" isHorizontal="true"> + <dc:Bounds x="160" y="120" width="2290" height="990" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_1qw5nm4_di" bpmnElement="SubProcess_0iljxjd" isExpanded="true"> + <dc:Bounds x="935" y="680" width="810" height="180" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1azew71_di" bpmnElement="Task_01ooik6"> + <dc:Bounds x="1255" y="720" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1wd8iqk_di" bpmnElement="EndEvent_1wd8iqk"> + <dc:Bounds x="1492" y="742" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0hmwdqq_di" bpmnElement="StartEvent_0hmwdqq"> + <dc:Bounds x="1042" y="742" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0oiiwjo_di" bpmnElement="SequenceFlow_0oiiwjo"> + <di:waypoint x="1078" y="760" /> + <di:waypoint x="1255" y="760" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0uckyao_di" bpmnElement="SequenceFlow_0uckyao"> + <di:waypoint x="1355" y="760" /> + <di:waypoint x="1492" y="760" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1lb7w6u_di" bpmnElement="Task_1vscxgp"> + <dc:Bounds x="1670" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0d1g3mv_di" bpmnElement="EndEvent_0d1g3mv"> + <dc:Bounds x="2212" y="332" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1pujgw8_di" bpmnElement="EndEvent_1pujgw8"> + <dc:Bounds x="1462" y="422" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0cbth6k_di" bpmnElement="ScriptTask_0cbth6k"> + <dc:Bounds x="1860" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0z7s0nx_di" bpmnElement="ExclusiveGateway_0z7s0nx" isMarkerVisible="true"> + <dc:Bounds x="1455" y="325" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1449" y="313" width="65" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1cvb0iq_di" bpmnElement="CallActivity_1cvb0iq"> + <dc:Bounds x="1290" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_04p0zjj_di" bpmnElement="ScriptTask_04p0zjj"> + <dc:Bounds x="695" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1nsbn4r_di" bpmnElement="Task_1o8fe1v"> + <dc:Bounds x="850" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0fcc3uy_di" bpmnElement="ExclusiveGateway_0fcc3uy" isMarkerVisible="true"> + <dc:Bounds x="975" y="325" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1006" y="315" width="49" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0g9vipz_di" bpmnElement="Task_08zavab"> + <dc:Bounds x="1060" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1tv1ow6_di" bpmnElement="Task_18urz3r"> + <dc:Bounds x="540" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0tam79l_di" bpmnElement="Task_1ossedo"> + <dc:Bounds x="290" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1g8cg9g_di" bpmnElement="ExclusiveGateway_1g8cg9g" isMarkerVisible="true"> + <dc:Bounds x="1195" y="325" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1141" y="406" width="58" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="212" y="332" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1o4zjvp_di" bpmnElement="SequenceFlow_1o4zjvp"> + <di:waypoint x="1220" y="350" /> + <di:waypoint x="1290" y="350" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1251" y="332" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_144cqr9_di" bpmnElement="SequenceFlow_144cqr9"> + <di:waypoint x="1160" y="350" /> + <di:waypoint x="1195" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_15fdf5d_di" bpmnElement="SequenceFlow_15fdf5d"> + <di:waypoint x="1025" y="350" /> + <di:waypoint x="1060" y="350" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1034" y="332" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_149lhmo_di" bpmnElement="SequenceFlow_149lhmo"> + <di:waypoint x="950" y="350" /> + <di:waypoint x="975" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1yus0c1_di" bpmnElement="SequenceFlow_1yus0c1"> + <di:waypoint x="640" y="350" /> + <di:waypoint x="695" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_183ypky_di" bpmnElement="SequenceFlow_183ypky"> + <di:waypoint x="390" y="350" /> + <di:waypoint x="420" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0qksr1g_di" bpmnElement="SequenceFlow_0qksr1g"> + <di:waypoint x="248" y="350" /> + <di:waypoint x="290" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1uqgdxr_di" bpmnElement="SequenceFlow_1uqgdxr"> + <di:waypoint x="795" y="350" /> + <di:waypoint x="850" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_00ba5l9_di" bpmnElement="SequenceFlow_00ba5l9"> + <di:waypoint x="1390" y="350" /> + <di:waypoint x="1455" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1jp9gjt_di" bpmnElement="SequenceFlow_1jp9gjt"> + <di:waypoint x="1505" y="350" /> + <di:waypoint x="1670" y="350" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1596" y="332" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1qa8miv_di" bpmnElement="SequenceFlow_1qa8miv"> + <di:waypoint x="1480" y="375" /> + <di:waypoint x="1480" y="422" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1489" y="383" width="12" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0r611x8_di" bpmnElement="SequenceFlow_0r611x8"> + <di:waypoint x="1000" y="375" /> + <di:waypoint x="1000" y="500" /> + <di:waypoint x="2230" y="500" /> + <di:waypoint x="2230" y="368" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1608" y="482" width="15" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1pj1j1o_di" bpmnElement="SequenceFlow_1pj1j1o"> + <di:waypoint x="1220" y="375" /> + <di:waypoint x="1220" y="422" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1199" y="378" width="12" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_1taw2p9_di" bpmnElement="EndEvent_1taw2p9"> + <dc:Bounds x="1202" y="422" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0uwsu46_di" bpmnElement="Task_13zoo6a"> + <dc:Bounds x="420" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1av6du3_di" bpmnElement="SequenceFlow_1av6du3"> + <di:waypoint x="520" y="350" /> + <di:waypoint x="540" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1aymwlt_di" bpmnElement="ServiceTask_1aymwlt"> + <dc:Bounds x="2020" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ozefu5_di" bpmnElement="SequenceFlow_0ozefu5"> + <di:waypoint x="2120" y="350" /> + <di:waypoint x="2212" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0pzts4p_di" bpmnElement="SequenceFlow_0pzts4p"> + <di:waypoint x="1960" y="350" /> + <di:waypoint x="2020" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1gkpl5q_di" bpmnElement="SequenceFlow_1gkpl5q"> + <di:waypoint x="1770" y="350" /> + <di:waypoint x="1860" y="350" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCommunicationService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCommunicationService.bpmn new file mode 100644 index 0000000000..a632266c2e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCommunicationService.bpmn @@ -0,0 +1,635 @@ +<?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_1xh5s36" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> + <bpmn:process id="CreateCommunicationService" name="CreateCommunicationService" isExecutable="true"> + <bpmn:startEvent id="StartEvent_1" name="start flow"> + <bpmn:outgoing>SequenceFlow_0lzwdto</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_0lzwdto" sourceRef="StartEvent_1" targetRef="Task_1beyt5u" /> + <bpmn:sequenceFlow id="SequenceFlow_1gjmyhd" sourceRef="Task_1beyt5u" targetRef="Task_0dz4tto" /> + <bpmn:scriptTask id="Task_1beyt5u" name="PreProcessRequest" scriptFormat="groovy"> + <bpmn:extensionElements> + <camunda:properties> + <camunda:property /> + </camunda:properties> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0lzwdto</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1gjmyhd</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_0dz4tto" name="Init Task Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1gjmyhd</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1vcepmd</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.prepareInitOperationStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1vcepmd" sourceRef="Task_0dz4tto" targetRef="ServiceTask_0ozije4" /> + <bpmn:serviceTask id="ServiceTask_0ozije4" 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_1vcepmd</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ltd3dc</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:scriptTask id="Task_1khpb1m" name="Generate E2EService Profile" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0kypqg8</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0akbbpi</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.generateE2EServiceProfile(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_0siw5ye" name="Pre Request Send To NSMF" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0akbbpi</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0j35uff</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.preRequestSend2NSMF(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_0y8x077" name="Send Request To NSMF"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${NSMF_endpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/json</camunda:entry> + <camunda:entry key="Authorization">Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CSMF_NSMFRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CSMF_NSMFResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CSMF_NSMFResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0j35uff</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1u66yqo</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="ServiceTask_0yyq6ly" name="Update Service Operation Status Creating"> + <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_1iiorr4</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15mad8z</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="ServiceTask_1t0awxp" name="Update Service 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/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_1inkg6e</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0elkfli</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:endEvent id="EndEvent_0lu4p9e" name="end"> + <bpmn:incoming>SequenceFlow_0elkfli</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0elkfli" sourceRef="ServiceTask_1t0awxp" targetRef="EndEvent_0lu4p9e" /> + <bpmn:scriptTask id="Task_1a4kd0x" name="Create Relationship CS-SS" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1uvyn2n</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1j65sro</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.createCSAndSSRelationship(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0akbbpi" sourceRef="Task_1khpb1m" targetRef="Task_0siw5ye" /> + <bpmn:callActivity id="CallCreateCommunicationService" name="CallCreateCommunicationService" calledElement="DoCreateCommunicationService"> + <bpmn:extensionElements> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="csInputMap" target="csInputMap" /> + <camunda:in source="serviceInstanceName" target="serviceInstanceName" /> + <camunda:in source="serviceType" target="serviceType" /> + <camunda:in source="uuiRequest" target="uuiRequest" /> + <camunda:in source="modelInvariantUuid" target="modelInvariantUuid" /> + <camunda:in source="modelUuid" target="modelUuid" /> + <camunda:in source="useInterval" target="useInterval" /> + <camunda:out source="sNSSAI_id" target="sNSSAI_id" /> + <camunda:out source="communicationProfileId" target="communicationProfileId" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1ds2e2l</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0x9rd1d</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1ltd3dc" sourceRef="ServiceTask_0ozije4" targetRef="Task_0k0z1g4" /> + <bpmn:sequenceFlow id="SequenceFlow_0x9rd1d" sourceRef="CallCreateCommunicationService" targetRef="ExclusiveGateway_1djfumr" /> + <bpmn:scriptTask id="Task_0u6zuwq" name="Update Finish Status In AAI " scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_114tqpz</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1fpj5vj</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_04321fy</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.updateFinishStatusInAAI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_04321fy" sourceRef="Task_0u6zuwq" targetRef="ScriptTask_1y7nvia" /> + <bpmn:sequenceFlow id="SequenceFlow_1inkg6e" sourceRef="ScriptTask_1y7nvia" targetRef="ServiceTask_1t0awxp" /> + <bpmn:scriptTask id="ScriptTask_1y7nvia" name="Prepare Complete Status in requestDB" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_04321fy</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1inkg6e</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.prepareCompleteStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1iiorr4" sourceRef="Task_0z4msb8" targetRef="ServiceTask_0yyq6ly" /> + <bpmn:scriptTask id="Task_0z4msb8" name="Prepare Update Operation Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1j65sro</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1iiorr4</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.prepareUpdateOperationStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="Task_0k0z1g4" name="Call DocomposeService" calledElement="DecomposeService"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="csServiceModelInfo" target="serviceModelInfo" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:out source="serviceDecomposition" target="csServiceDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1ltd3dc</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_13aldsi</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="Task_1iyttxg" name="Prepare Compose E2E Template" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_13aldsi</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1f1zdf9</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.prepareDoComposeE2E(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_0w00x24" name="Call e2e DocomposeService" calledElement="DecomposeService"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="e2eServiceModelInfo" target="serviceModelInfo" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:out source="serviceDecomposition" target="e2eServiceDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1f1zdf9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ofzxsf</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1ofzxsf" sourceRef="CallActivity_0w00x24" targetRef="ScriptTask_0cdmkso" /> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1w15bcr" name="Goto Create Communication Service"> + <bpmn:incoming>SequenceFlow_18guyhw</bpmn:incoming> + <bpmn:linkEventDefinition name="CreateCommunicationService" /> + </bpmn:intermediateThrowEvent> + <bpmn:sequenceFlow id="SequenceFlow_13aldsi" sourceRef="Task_0k0z1g4" targetRef="Task_1iyttxg" /> + <bpmn:sequenceFlow id="SequenceFlow_1f1zdf9" sourceRef="Task_1iyttxg" targetRef="CallActivity_0w00x24" /> + <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_0mnp81i" name="CreateCommunicationService"> + <bpmn:outgoing>SequenceFlow_1ds2e2l</bpmn:outgoing> + <bpmn:linkEventDefinition name="CreateCommunicationService" /> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="SequenceFlow_1ds2e2l" sourceRef="IntermediateThrowEvent_0mnp81i" targetRef="CallCreateCommunicationService" /> + <bpmn:subProcess id="SubProcess_1rxymch" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true"> + <bpmn:endEvent id="EndEvent_0zmwd5y"> + <bpmn:incoming>SequenceFlow_1kmsen3</bpmn:incoming> + </bpmn:endEvent> + <bpmn:startEvent id="StartEvent_0wgf0cs"> + <bpmn:outgoing>SequenceFlow_07fl9jy</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_0uaz13d" /> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_07fl9jy" sourceRef="StartEvent_0wgf0cs" targetRef="ScriptTask_18gv408" /> + <bpmn:scriptTask id="ScriptTask_18gv408" name="Send Error Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_07fl9jy</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1kmsen3</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.sendSyncError(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1kmsen3" sourceRef="ScriptTask_18gv408" targetRef="EndEvent_0zmwd5y" /> + </bpmn:subProcess> + <bpmn:exclusiveGateway id="ExclusiveGateway_1djfumr" name="Is create in aai Successful?" default="SequenceFlow_0c89n51"> + <bpmn:incoming>SequenceFlow_0x9rd1d</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1b66kfh</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0c89n51</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1b66kfh" name="Yes" sourceRef="ExclusiveGateway_1djfumr" targetRef="ScriptTask_0sxtscf"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") == null}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1r29nqs" name="Goto process NSMF"> + <bpmn:incoming>SequenceFlow_1u66yqo</bpmn:incoming> + <bpmn:linkEventDefinition id="LinkEventDefinition_1o65kbk" name="ProcessNSMF" /> + </bpmn:intermediateThrowEvent> + <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_08tr730" name="ProcessNSMF"> + <bpmn:outgoing>SequenceFlow_0hkz9h0</bpmn:outgoing> + <bpmn:linkEventDefinition id="LinkEventDefinition_0g6ab6j" name="ProcessNSMF" /> + </bpmn:intermediateCatchEvent> + <bpmn:scriptTask id="ScriptTask_01pvcx5" name="Process NSMF response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0hkz9h0</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_056nqyg</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.processNSMFResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_15mad8z" sourceRef="ServiceTask_0yyq6ly" targetRef="IntermediateThrowEvent_1u6yhg1" /> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1u6yhg1" name="Goto check processing status"> + <bpmn:incoming>SequenceFlow_15mad8z</bpmn:incoming> + <bpmn:linkEventDefinition name="CheckProcessingStatus" /> + </bpmn:intermediateThrowEvent> + <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_13zkj1k" name="CheckProcessingStatus"> + <bpmn:outgoing>SequenceFlow_0spge8t</bpmn:outgoing> + <bpmn:linkEventDefinition name="CheckProcessingStatus" /> + </bpmn:intermediateCatchEvent> + <bpmn:exclusiveGateway id="ExclusiveGateway_19x2qmv" name="Is nsmf ansyc response Successful?"> + <bpmn:incoming>SequenceFlow_056nqyg</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1uvyn2n</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_114tqpz</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1uvyn2n" name="Yes" sourceRef="ExclusiveGateway_19x2qmv" targetRef="Task_1a4kd0x"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ProcessNsmfSuccess") == "OK"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1j65sro" sourceRef="Task_1a4kd0x" targetRef="Task_0z4msb8" /> + <bpmn:sequenceFlow id="SequenceFlow_056nqyg" sourceRef="ScriptTask_01pvcx5" targetRef="ExclusiveGateway_19x2qmv" /> + <bpmn:endEvent id="EndEvent_1g8f1f0"> + <bpmn:incoming>SequenceFlow_0c89n51</bpmn:incoming> + <bpmn:errorEventDefinition errorRef="Error_1w6xfoc" /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0c89n51" name="no" sourceRef="ExclusiveGateway_1djfumr" targetRef="EndEvent_1g8f1f0" /> + <bpmn:sequenceFlow id="SequenceFlow_114tqpz" name="No" sourceRef="ExclusiveGateway_19x2qmv" targetRef="Task_0u6zuwq"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ProcessNsmfSuccess") == "ERROR"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:scriptTask id="ScriptTask_0sxtscf" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1b66kfh</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0kypqg8</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.sendSyncResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_0cdmkso" name="Parse CS Params From Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1ofzxsf</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18guyhw</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.parseCSParamsFromReq(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_18guyhw" sourceRef="ScriptTask_0cdmkso" targetRef="IntermediateThrowEvent_1w15bcr" /> + <bpmn:sequenceFlow id="SequenceFlow_0kypqg8" sourceRef="ScriptTask_0sxtscf" targetRef="Task_1khpb1m" /> + <bpmn:callActivity id="CallCheckServiceProcessStatus" name="CallCheckServiceProcessStatus" calledElement="CheckServiceProcessStatus"> + <bpmn:extensionElements> + <camunda:in source="e2eServiceInstanceId" target="serviceInstanceId" /> + <camunda:in source="e2eOperationId" target="operationId" /> + <camunda:in source="successConditions" target="successConditions" /> + <camunda:in source="processServiceType" target="processServiceType" /> + <camunda:in source="errorConditions" target="errorConditions" /> + <camunda:in source="timeOut" target="timeOut" /> + <camunda:in source="successParamMap" target="successParamMap" /> + <camunda:in source="errorParamMap" target="errorParamMap" /> + <camunda:out source="orchestrationStatus" target="orchestrationStatus" /> + <camunda:out source="operationStatus" target="operationStatus" /> + <camunda:out source="operationContent" target="operationContent" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="timeOutParamMap" target="timeOutParamMap" /> + <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="operationId" target="parentOperationId" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_079hxvu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1fpj5vj</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1fpj5vj" sourceRef="CallCheckServiceProcessStatus" targetRef="Task_0u6zuwq" /> + <bpmn:sequenceFlow id="SequenceFlow_0spge8t" sourceRef="IntermediateThrowEvent_13zkj1k" targetRef="Task_0misguw" /> + <bpmn:scriptTask id="Task_0misguw" name="Prepare Call CheckServiceProcessStatus" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0spge8t</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_079hxvu</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.prepareCallCheckProcessStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_079hxvu" sourceRef="Task_0misguw" targetRef="CallCheckServiceProcessStatus" /> + <bpmn:sequenceFlow id="SequenceFlow_0j35uff" sourceRef="Task_0siw5ye" targetRef="ServiceTask_0y8x077" /> + <bpmn:sequenceFlow id="SequenceFlow_1u66yqo" sourceRef="ServiceTask_0y8x077" targetRef="IntermediateThrowEvent_1r29nqs" /> + <bpmn:sequenceFlow id="SequenceFlow_0hkz9h0" sourceRef="IntermediateCatchEvent_08tr730" targetRef="ScriptTask_01pvcx5" /> + </bpmn:process> + <bpmn:error id="Error_1w6xfoc" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateCommunicationService"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="162" y="99" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="158" y="142" width="46" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0lzwdto_di" bpmnElement="SequenceFlow_0lzwdto"> + <di:waypoint x="198" y="117" /> + <di:waypoint x="250" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1gjmyhd_di" bpmnElement="SequenceFlow_1gjmyhd"> + <di:waypoint x="350" y="117" /> + <di:waypoint x="390" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1jxjk8b_di" bpmnElement="Task_1beyt5u"> + <dc:Bounds x="250" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1a9q04w_di" bpmnElement="Task_0dz4tto"> + <dc:Bounds x="390" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1vcepmd_di" bpmnElement="SequenceFlow_1vcepmd"> + <di:waypoint x="490" y="117" /> + <di:waypoint x="550" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0ozije4_di" bpmnElement="ServiceTask_0ozije4"> + <dc:Bounds x="550" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_12shhv4_di" bpmnElement="Task_1khpb1m"> + <dc:Bounds x="710" y="266" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1fiq8pw_di" bpmnElement="Task_0siw5ye"> + <dc:Bounds x="890" y="266" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0y8x077_di" bpmnElement="ServiceTask_0y8x077"> + <dc:Bounds x="1120" y="266" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0yyq6ly_di" bpmnElement="ServiceTask_0yyq6ly"> + <dc:Bounds x="1230" y="496" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1t0awxp_di" bpmnElement="ServiceTask_1t0awxp"> + <dc:Bounds x="1230" y="782" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0lu4p9e_di" bpmnElement="EndEvent_0lu4p9e"> + <dc:Bounds x="1382" y="804" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1390" y="850" width="19" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0elkfli_di" bpmnElement="SequenceFlow_0elkfli"> + <di:waypoint x="1330" y="822" /> + <di:waypoint x="1382" y="822" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1q4zssd_di" bpmnElement="Task_1a4kd0x"> + <dc:Bounds x="910" y="496" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0akbbpi_di" bpmnElement="SequenceFlow_0akbbpi"> + <di:waypoint x="810" y="306" /> + <di:waypoint x="890" y="306" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1d14p1s_di" bpmnElement="CallCreateCommunicationService"> + <dc:Bounds x="250" y="266" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ltd3dc_di" bpmnElement="SequenceFlow_1ltd3dc"> + <di:waypoint x="650" y="117" /> + <di:waypoint x="720" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0x9rd1d_di" bpmnElement="SequenceFlow_0x9rd1d"> + <di:waypoint x="350" y="306" /> + <di:waypoint x="415" y="306" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1anjycx_di" bpmnElement="Task_0u6zuwq"> + <dc:Bounds x="910" y="782" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_04321fy_di" bpmnElement="SequenceFlow_04321fy"> + <di:waypoint x="1010" y="822" /> + <di:waypoint x="1080" y="822" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1inkg6e_di" bpmnElement="SequenceFlow_1inkg6e"> + <di:waypoint x="1180" y="822" /> + <di:waypoint x="1230" y="822" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1y7nvia_di" bpmnElement="ScriptTask_1y7nvia"> + <dc:Bounds x="1080" y="782" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1iiorr4_di" bpmnElement="SequenceFlow_1iiorr4"> + <di:waypoint x="1180" y="536" /> + <di:waypoint x="1230" y="536" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1rv123h_di" bpmnElement="Task_0z4msb8"> + <dc:Bounds x="1080" y="496" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0z3vej2_di" bpmnElement="Task_0k0z1g4"> + <dc:Bounds x="720" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_04n3rws_di" bpmnElement="Task_1iyttxg"> + <dc:Bounds x="890" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0w00x24_di" bpmnElement="CallActivity_0w00x24"> + <dc:Bounds x="1040" y="74" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ofzxsf_di" bpmnElement="SequenceFlow_1ofzxsf"> + <di:waypoint x="1140" y="114" /> + <di:waypoint x="1210" y="114" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1lz4unp_di" bpmnElement="IntermediateThrowEvent_1w15bcr"> + <dc:Bounds x="1382" y="96" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1364" y="139" width="77" height="40" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_13aldsi_di" bpmnElement="SequenceFlow_13aldsi"> + <di:waypoint x="820" y="117" /> + <di:waypoint x="890" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1f1zdf9_di" bpmnElement="SequenceFlow_1f1zdf9"> + <di:waypoint x="990" y="117" /> + <di:waypoint x="1040" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateCatchEvent_0r2oht8_di" bpmnElement="IntermediateThrowEvent_0mnp81i"> + <dc:Bounds x="162" y="288" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="139" y="331" width="87" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ds2e2l_di" bpmnElement="SequenceFlow_1ds2e2l"> + <di:waypoint x="198" y="306" /> + <di:waypoint x="250" y="306" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_1rxymch_di" bpmnElement="SubProcess_1rxymch" isExpanded="true"> + <dc:Bounds x="290" y="1053" width="781" height="196" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0zmwd5y_di" bpmnElement="EndEvent_0zmwd5y"> + <dc:Bounds x="1002" y="1139" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1djfumr_di" bpmnElement="ExclusiveGateway_1djfumr" isMarkerVisible="true"> + <dc:Bounds x="415" y="281" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="404" y="244" width="73" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1b66kfh_di" bpmnElement="SequenceFlow_1b66kfh"> + <di:waypoint x="465" y="306" /> + <di:waypoint x="530" y="306" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="491" y="288" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1r29nqs_di" bpmnElement="IntermediateThrowEvent_1r29nqs"> + <dc:Bounds x="1382" y="288" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1371" y="331" width="66" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateCatchEvent_08tr730_di" bpmnElement="IntermediateCatchEvent_08tr730"> + <dc:Bounds x="162" y="518" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="148" y="561" width="72" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_01pvcx5_di" bpmnElement="ScriptTask_01pvcx5"> + <dc:Bounds x="390" y="496" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_15mad8z_di" bpmnElement="SequenceFlow_15mad8z"> + <di:waypoint x="1330" y="536" /> + <di:waypoint x="1382" y="536" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_0kwoo94_di" bpmnElement="IntermediateThrowEvent_1u6yhg1"> + <dc:Bounds x="1382" y="518" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1359" y="561" width="87" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateCatchEvent_0ky7904_di" bpmnElement="IntermediateThrowEvent_13zkj1k"> + <dc:Bounds x="162" y="804" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="138" y="847" width="86" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_19x2qmv_di" bpmnElement="ExclusiveGateway_19x2qmv" isMarkerVisible="true"> + <dc:Bounds x="605" y="511" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="602" y="472" width="68" height="40" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1uvyn2n_di" bpmnElement="SequenceFlow_1uvyn2n"> + <di:waypoint x="655" y="536" /> + <di:waypoint x="910" y="536" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="741" y="519" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1j65sro_di" bpmnElement="SequenceFlow_1j65sro"> + <di:waypoint x="1010" y="536" /> + <di:waypoint x="1080" y="536" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_056nqyg_di" bpmnElement="SequenceFlow_056nqyg"> + <di:waypoint x="490" y="536" /> + <di:waypoint x="605" y="536" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="StartEvent_0wgf0cs_di" bpmnElement="StartEvent_0wgf0cs"> + <dc:Bounds x="332" y="1139" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_07fl9jy_di" bpmnElement="SequenceFlow_07fl9jy"> + <di:waypoint x="368" y="1157" /> + <di:waypoint x="620" y="1157" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_1bombkp_di" bpmnElement="EndEvent_1g8f1f0"> + <dc:Bounds x="422" y="392" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0c89n51_di" bpmnElement="SequenceFlow_0c89n51"> + <di:waypoint x="440" y="331" /> + <di:waypoint x="440" y="392" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="449" y="345" width="13" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_18gv408_di" bpmnElement="ScriptTask_18gv408"> + <dc:Bounds x="620" y="1117" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1kmsen3_di" bpmnElement="SequenceFlow_1kmsen3"> + <di:waypoint x="720" y="1157" /> + <di:waypoint x="1002" y="1157" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_114tqpz_di" bpmnElement="SequenceFlow_114tqpz"> + <di:waypoint x="630" y="561" /> + <di:waypoint x="630" y="630" /> + <di:waypoint x="980" y="630" /> + <di:waypoint x="980" y="782" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="799" y="612" width="15" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0sxtscf_di" bpmnElement="ScriptTask_0sxtscf"> + <dc:Bounds x="530" y="266" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0cdmkso_di" bpmnElement="ScriptTask_0cdmkso"> + <dc:Bounds x="1210" y="74" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_18guyhw_di" bpmnElement="SequenceFlow_18guyhw"> + <di:waypoint x="1310" y="114" /> + <di:waypoint x="1382" y="114" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0kypqg8_di" bpmnElement="SequenceFlow_0kypqg8"> + <di:waypoint x="630" y="306" /> + <di:waypoint x="710" y="306" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0oktqmg_di" bpmnElement="CallCheckServiceProcessStatus"> + <dc:Bounds x="620" y="782" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1fpj5vj_di" bpmnElement="SequenceFlow_1fpj5vj"> + <di:waypoint x="720" y="822" /> + <di:waypoint x="910" y="822" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0spge8t_di" bpmnElement="SequenceFlow_0spge8t"> + <di:waypoint x="198" y="822" /> + <di:waypoint x="330" y="822" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0bi31xq_di" bpmnElement="Task_0misguw"> + <dc:Bounds x="330" y="782" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_079hxvu_di" bpmnElement="SequenceFlow_079hxvu"> + <di:waypoint x="430" y="822" /> + <di:waypoint x="620" y="822" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0j35uff_di" bpmnElement="SequenceFlow_0j35uff"> + <di:waypoint x="990" y="306" /> + <di:waypoint x="1120" y="306" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1u66yqo_di" bpmnElement="SequenceFlow_1u66yqo"> + <di:waypoint x="1220" y="306" /> + <di:waypoint x="1382" y="306" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0hkz9h0_di" bpmnElement="SequenceFlow_0hkz9h0"> + <di:waypoint x="198" y="536" /> + <di:waypoint x="390" y="536" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateCommunicationService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateCommunicationService.bpmn new file mode 100644 index 0000000000..1f0e10b1c1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateCommunicationService.bpmn @@ -0,0 +1,115 @@ +<?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" id="Definitions_152rp63" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> + <bpmn:process id="DoCreateCommunicationService" name="DoCreateCommunicationService" isExecutable="true"> + <bpmn:startEvent id="StartEvent_1" name="start"> + <bpmn:outgoing>SequenceFlow_0r43nhn</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_0r43nhn" sourceRef="StartEvent_1" targetRef="Task_1n00ul2" /> + <bpmn:scriptTask id="Task_1n00ul2" name="Pre Process Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0r43nhn</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ojuala</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new DoCreateCommunicationService() +csi.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_13cimkc" name="Create Communication Service Profile" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0mxvw9q</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15e8qrt</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new DoCreateCommunicationService() +csi.createCommunicationServiceProfile(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_02h3nyo" name="Create Communication Service" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1ojuala</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0mxvw9q</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new DoCreateCommunicationService() +csi.createCommunicationService(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:endEvent id="EndEvent_0tx74b8" name="end"> + <bpmn:incoming>SequenceFlow_15e8qrt</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0mxvw9q" sourceRef="Task_02h3nyo" targetRef="Task_13cimkc" /> + <bpmn:sequenceFlow id="SequenceFlow_15e8qrt" sourceRef="Task_13cimkc" targetRef="EndEvent_0tx74b8" /> + <bpmn:sequenceFlow id="SequenceFlow_1ojuala" sourceRef="Task_1n00ul2" targetRef="Task_02h3nyo" /> + <bpmn:subProcess id="SubProcess_0hvqoiu" name="Java Exception Handling Sub Process" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_06faevu"> + <bpmn:outgoing>SequenceFlow_1jckdn4</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_1idslt4" /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_1xkvl7n"> + <bpmn:incoming>SequenceFlow_0ixyf17</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_15u2oe2" name="Process Error" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1jckdn4</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ixyf17</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.common.scripts.* +ExceptionUtil exceptionUtil = new ExceptionUtil() +exceptionUtil.processJavaException(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0ixyf17" sourceRef="ScriptTask_15u2oe2" targetRef="EndEvent_1xkvl7n" /> + <bpmn:sequenceFlow id="SequenceFlow_1jckdn4" sourceRef="StartEvent_06faevu" targetRef="ScriptTask_15u2oe2" /> + </bpmn:subProcess> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateCommunicationService"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="179" y="99" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="186" y="142" width="23" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0r43nhn_di" bpmnElement="SequenceFlow_0r43nhn"> + <di:waypoint x="215" y="117" /> + <di:waypoint x="290" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1ilqwj5_di" bpmnElement="Task_1n00ul2"> + <dc:Bounds x="290" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0vpnfpe_di" bpmnElement="Task_13cimkc"> + <dc:Bounds x="660" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_03bitgg_di" bpmnElement="Task_02h3nyo"> + <dc:Bounds x="480" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0tx74b8_di" bpmnElement="EndEvent_0tx74b8"> + <dc:Bounds x="912" y="99" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="921" y="142" width="19" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0mxvw9q_di" bpmnElement="SequenceFlow_0mxvw9q"> + <di:waypoint x="580" y="117" /> + <di:waypoint x="660" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_15e8qrt_di" bpmnElement="SequenceFlow_15e8qrt"> + <di:waypoint x="760" y="117" /> + <di:waypoint x="912" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ojuala_di" bpmnElement="SequenceFlow_1ojuala"> + <di:waypoint x="390" y="117" /> + <di:waypoint x="480" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_0hvqoiu_di" bpmnElement="SubProcess_0hvqoiu" isExpanded="true"> + <dc:Bounds x="290" y="250" width="417" height="161" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_06faevu_di" bpmnElement="StartEvent_06faevu"> + <dc:Bounds x="327" y="317" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1xkvl7n_di" bpmnElement="EndEvent_1xkvl7n"> + <dc:Bounds x="613" y="317" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_15u2oe2_di" bpmnElement="ScriptTask_15u2oe2"> + <dc:Bounds x="438" y="295" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ixyf17_di" bpmnElement="SequenceFlow_0ixyf17"> + <di:waypoint x="538" y="335" /> + <di:waypoint x="613" y="335" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1jckdn4_di" bpmnElement="SequenceFlow_1jckdn4"> + <di:waypoint x="363" y="335" /> + <di:waypoint x="438" y="335" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/common/src/main/java/org/onap/so/beans/nsmf/EsrInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/EsrInfo.java index c124bfa944..d720399293 100644 --- a/common/src/main/java/org/onap/so/beans/nsmf/EsrInfo.java +++ b/common/src/main/java/org/onap/so/beans/nsmf/EsrInfo.java @@ -21,9 +21,10 @@ package org.onap.so.beans.nsmf; import com.fasterxml.jackson.annotation.JsonInclude; +import java.io.Serializable; @JsonInclude(JsonInclude.Include.NON_NULL) -public class EsrInfo { +public class EsrInfo implements Serializable { private String vendor; diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NSSI.java b/common/src/main/java/org/onap/so/beans/nsmf/NSSI.java new file mode 100644 index 0000000000..a57458f2cf --- /dev/null +++ b/common/src/main/java/org/onap/so/beans/nsmf/NSSI.java @@ -0,0 +1,60 @@ +/*- + * ============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.beans.nsmf; + +public class NSSI { + + private String nssiId; + + private String modelInvariantId; + + private String modelVersionId; + + public NSSI(String nssiId, String modelInvariantId, String modelVersionId) { + this.nssiId = nssiId; + this.modelInvariantId = modelInvariantId; + this.modelVersionId = modelVersionId; + } + + public String getNssiId() { + return nssiId; + } + + public void setNssiId(String nssiId) { + this.nssiId = nssiId; + } + + public String getModelInvariantId() { + return modelInvariantId; + } + + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + public String getModelVersionId() { + return modelVersionId; + } + + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } +} diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NewNsst.java b/common/src/main/java/org/onap/so/beans/nsmf/NewNsst.java index e13aa5000a..68aebf2df2 100644 --- a/common/src/main/java/org/onap/so/beans/nsmf/NewNsst.java +++ b/common/src/main/java/org/onap/so/beans/nsmf/NewNsst.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (C) 2020 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. |