diff options
Diffstat (limited to 'bpmn')
86 files changed, 5207 insertions, 2047 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy index cae80e9137..3e451a5a4a 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy @@ -25,7 +25,7 @@ import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.rest.APIResponse; import org.onap.so.rest.RESTClient import org.onap.so.rest.RESTConfig -import org.onap.so.logger.MessageEnum +import org.springframework.web.util.UriUtils import org.onap.so.logger.MsoLogger class AaiUtil { @@ -43,6 +43,8 @@ class AaiUtil { public AaiUtil(AbstractServiceTaskProcessor taskProcessor) { this.taskProcessor = taskProcessor } + public AaiUtil() { + } public String getNetworkGenericVnfEndpoint(DelegateExecution execution) { String endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) @@ -87,6 +89,12 @@ class AaiUtil { return uri } + public String getNetworkDeviceUri(DelegateExecution execution) { + def uri = getUri(execution, 'device') + msoLogger.debug('AaiUtil.getNetworkDeviceUri() - AAI URI: ' + uri) + return uri + } + public String getBusinessCustomerUri(DelegateExecution execution) { def uri = getUri(execution, 'customer') msoLogger.debug('AaiUtil.getBusinessCustomerUri() - AAI URI: ' + uri) @@ -109,7 +117,7 @@ class AaiUtil { } //public String getBusinessCustomerUriv7(DelegateExecution execution) { - // // //def uri = getUri(execution, BUSINESS_CUSTOMERV7) + // //def uri = getUri(execution, BUSINESS_CUSTOMERV7) // def uri = getUri(execution, 'Customer') // msoLogger.debug('AaiUtil.getBusinessCustomerUriv7() - AAI URI: ' + uri) // return uri @@ -178,9 +186,30 @@ class AaiUtil { (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, "Internal Error: One of the following should be defined in MSO URN properties file: ${versionWithResourceKey}, ${versionWithProcessKey}, ${DEFAULT_VERSION_KEY}") } + public String getMainProcessKey(DelegateExecution execution) { + DelegateExecution exec = execution + + while (true) { + DelegateExecution parent = exec.getSuperExecution() + + if (parent == null) { + parent = exec.getParent() + + if (parent == null) { + break + } + } + + exec = parent + } + + return execution.getProcessEngineServices().getRepositoryService() + .getProcessDefinition(exec.getProcessDefinitionId()).getKey() + } + public String getUri(DelegateExecution execution, resourceName) { - def processKey = taskProcessor.getMainProcessKey(execution) + def processKey = getMainProcessKey(execution) //set namespace setNamespace(execution) @@ -656,9 +685,9 @@ class AaiUtil { private def getPInterface(DelegateExecution execution, String aai_uri) { - String namespace = getNamespaceFromUri(aai_uri) + String namespace = getNamespaceFromUri(execution, aai_uri) String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String serviceAaiPath = ${aai_endpoint}${aai_uri} + String serviceAaiPath = aai_endpoint + aai_uri APIResponse response = executeAAIGetCall(execution, serviceAaiPath) return new XmlParser().parseText(response.getResponseBodyAsString()) @@ -680,58 +709,102 @@ class AaiUtil { String aai_uri = '/aai/v14/network/logical-links' String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String serviceAaiPath = ${aai_endpoint}${aai_uri} + String serviceAaiPath = aai_endpoint + aai_uri APIResponse response = executeAAIGetCall(execution, serviceAaiPath) def logicalLinks = new XmlParser().parseText(response.getResponseBodyAsString()) - logicalLinks."logical-links".find { link -> - def pInterface = [] + logicalLinks."logical-link".each { link -> + def isRemoteLink = false + def pInterfaces = [] def relationship = link."relationship-list"."relationship" - relationship.each { - if ("p-interface".compareToIgnoreCase(it."related-to")) { - pInterface.add(it) + relationship.each { rel -> + if ("ext-aai-network".compareToIgnoreCase("${rel."related-to"[0]?.text()}") == 0) { + isRemoteLink = true + } + if ("p-interface".compareToIgnoreCase("${rel."related-to"[0]?.text()}") == 0) { + pInterfaces.add(rel) } } - if (pInterface.size() == 2) { + + // if remote link then process + if (isRemoteLink) { + + // find remote p interface def localTP = null def remoteTP = null - if (pInterface[0]."related-link".contains("ext-aai-networks")) { - remoteTP = pInterface[0] - localTP = pInterface[1] - } + def pInterface0 = pInterfaces[0] + def pIntfUrl = "${pInterface0."related-link"[0].text()}" - if (pInterface[1]."related-link".contains("ext-aai-networks")) { - localTP = pInterface[0] - remoteTP = pInterface[1] + if (isRemotePInterface(execution, pIntfUrl)) { + remoteTP = pInterfaces[0] + localTP = pInterfaces[1] + } else { + localTP = pInterfaces[0] + remoteTP = pInterfaces[1] } if (localTP != null && remoteTP != null) { // give local tp - var intfLocal = getPInterface(execution, localTP."related-link") - tpInfotpInfo.put("local-access-node-id", localTP."related-link".split("/")[6]) + def tpUrl = "${localTP."related-link"[0]?.text()}" + def intfLocal = getPInterface(execution, "${localTP?."related-link"[0]?.text()}") + tpInfo.put("local-access-node-id", tpUrl.split("/")[6]) - def networkRef = intfLocal."network-ref".split("/") - tpInfo.put("local-access-provider-id", networkRef[1]) - tpInfo.put("local-access-client-id", networkRef[3]) - tpInfo.put("local-access-topology-id", networkRef[5]) - tpInfo.put("local-access-ltp-id", localTP."interface-name") + def networkRef = "${intfLocal."network-ref"[0]?.text()}".split("/") + if (networkRef.size() == 6) { + tpInfo.put("local-access-provider-id", networkRef[1]) + tpInfo.put("local-access-client-id", networkRef[3]) + tpInfo.put("local-access-topology-id", networkRef[5]) + } + def ltpIdStr = tpUrl?.substring(tpUrl?.lastIndexOf("/") + 1) + if (ltpIdStr?.contains("-")) { + tpInfo.put("local-access-ltp-id", ltpIdStr?.substring(ltpIdStr?.lastIndexOf("-") + 1)) + } - // give local tp - var intfRemote = getPInterface(execution, remoteTP."related-link") - tpInfo.put("remote-access-node-id", remoteTP."related-link".split("/")[6]) - def networkRefRemote = intfRemote."network-ref".split("/") - tpInfo.put("remote-access-provider-id", networkRefRemote[1]) - tpInfo.put("remote-access-client-id", networkRefRemote[3]) - tpInfo.put("remote-access-topology-id", networkRefRemote[5]) - tpInfo.put("remote-access-ltp-id", remoteTP."interface-name") + // give remote tp + tpUrl = "${remoteTP."related-link"[0]?.text()}" + def intfRemote = getPInterface(execution, "${remoteTP."related-link"[0].text()}") + tpInfo.put("remote-access-node-id", tpUrl.split("/")[6]) + + def networkRefRemote = "${intfRemote."network-ref"[0]?.text()}".split("/") + + if (networkRefRemote.size() == 6) { + tpInfo.put("remote-access-provider-id", networkRefRemote[1]) + tpInfo.put("remote-access-client-id", networkRefRemote[3]) + tpInfo.put("remote-access-topology-id", networkRefRemote[5]) + } + def ltpIdStrR = tpUrl?.substring(tpUrl?.lastIndexOf("/") + 1) + if (ltpIdStrR?.contains("-")) { + tpInfo.put("remote-access-ltp-id", ltpIdStrR?.substring(ltpIdStr?.lastIndexOf("-") + 1)) + } + return tpInfo } } } return tpInfo } + + // this method check if pInterface is remote + private def isRemotePInterface(DelegateExecution execution, String uri) { + def aai_uri = uri.substring(0, uri.indexOf("/p-interfaces")) + + String namespace = getNamespaceFromUri(execution, aai_uri) + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String serviceAaiPath = aai_endpoint + aai_uri + + APIResponse response = executeAAIGetCall(execution, serviceAaiPath) + def pnf = new XmlParser().parseText(response.getResponseBodyAsString()) + + def relationship = pnf."relationship-list"."relationship" + relationship.each { + if ("ext-aai-network".compareToIgnoreCase("${it."related-to"[0]?.text()}") == 0) { + return true + } + } + return false + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy index 1e2a703e70..0692e5022a 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy @@ -755,8 +755,6 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess public void setBasicDBAuthHeader(DelegateExecution execution, isDebugLogEnabled) { try { String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution) - utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled) - def encodedString = utils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution)) execution.setVariable("BasicAuthHeaderValueDB",encodedString) } catch (IOException ex) { diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy index 8b786bc152..bcd740eae9 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy @@ -43,7 +43,6 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ execution.setVariable("CVGN_queryVolumeGroupResponseCode",null) execution.setVariable("CVGN_queryVolumeGroupResponse","") execution.setVariable("CVGN_ResponseCode",null) -// execution.setVariable("CVGN_ErrorResponse","") execution.setVariable("RollbackData", null) } @@ -125,10 +124,6 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ // generates a WorkflowException if the A&AI query returns a response code other than 200/404 public void handleAAIQueryFailure(DelegateExecution execution) { msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CVGN_queryVolumeGroupResponseCode"), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "ErrorResponse is:\n" + execution.getVariable("CVGN_queryVolumeGroupResponse")); - //String processKey = getProcessKey(execution); - //WorkflowException exception = new WorkflowException(processKey, 5000, - //execution.getVariable("CVGN_queryVolumeGroupResponse")) - //execution.setVariable("WorkflowException", exception) } // generates a WorkflowException if the volume group name does not match AAI record for this volume group @@ -137,16 +132,6 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ " is not associated with " + execution.getVariable("CVGN_volumeGroupName") msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, errorNotAssociated, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, errorNotAssociated) - //String processKey = getProcessKey(execution); - //WorkflowException exception = new WorkflowException(processKey, 1002, - // errorNotAssociated) - //execution.setVariable("WorkflowException", exception) } - // sends a successful WorkflowResponse - public void reportSuccess(DelegateExecution execution) { - msoLogger.debug("Sending 200 back to the caller") - def responseXML = "" - execution.setVariable("WorkflowResponse", responseXML) - } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy index 2c2cd8269c..7d4adaea58 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy @@ -37,9 +37,9 @@ class ExternalAPIUtil { public MsoUtils utils = new MsoUtils() ExceptionUtil exceptionUtil = new ExceptionUtil() - + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExternalAPIUtil.class) - + public static final String PostServiceOrderRequestsTemplate = "{\n" + "\t\"externalId\": <externalId>,\n" + @@ -83,6 +83,8 @@ class ExternalAPIUtil { "\t} \n" + "}" + public ExternalAPIUtil() { + } // public String getUri(DelegateExecution execution, resourceName) { // diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java index c3511e69a4..78f3e96978 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java @@ -20,13 +20,14 @@ package org.onap.so.bpmn.common.baseclient; +import org.onap.so.logging.jaxrs.filter.SpringClientFilter; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.http.client.BufferingClientHttpRequestFactory; -import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestTemplate; @@ -59,11 +60,12 @@ public class BaseClient<I,O> { public O post(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { return run(data, HttpMethod.POST, typeRef, uriVariables); } - + public O run(I data, HttpMethod method, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { HttpEntity<I> requestEntity = new HttpEntity<I>(data, getHttpHeader()); RestTemplate restTemplate = new RestTemplate(); - restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory())); + restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory())); + restTemplate.getInterceptors().add(new SpringClientFilter()); ResponseEntity<O> responseEntity = restTemplate.exchange(getTargetUrl(), method, requestEntity, typeRef, uriVariables); return responseEntity.getBody(); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java index 24c0548641..5e49ffcf40 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java @@ -47,7 +47,8 @@ public class RequestParameters implements Serializable { private List<Map<String, Object>> userParams = new ArrayList<>(); @JsonProperty("aLaCarte") private Boolean aLaCarte; - + @JsonProperty("payload") + private String payload; public String getSubscriptionServiceType() { return subscriptionServiceType; @@ -68,6 +69,13 @@ public class RequestParameters implements Serializable { public Boolean isaLaCarte() { return aLaCarte; } + + public String getPayload(){ + return payload; + } + public void setPayload(String value){ + this.payload = value; + } public List<Map<String, Object>> getUserParams() { return userParams; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index 6d5fb2f825..eb4f4ca0d5 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -190,14 +190,19 @@ public class BBInputSetup implements JavaDelegate { if(requestDetails == null) { requestDetails = bbInputSetupUtils.getRequestDetails(requestId); } - ModelType modelType = requestDetails.getModelInfo().getModelType(); - if (aLaCarte && modelType.equals(ModelType.service)) { - return this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId); - } else if (aLaCarte && !modelType.equals(ModelType.service)) { - return this.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, - vnfType); - } else { - return this.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + if (requestDetails.getModelInfo() == null) { + return this.getGBBCM(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId); + } + else { + ModelType modelType = requestDetails.getModelInfo().getModelType(); + if (aLaCarte && modelType.equals(ModelType.service)) { + return this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId); + } else if (aLaCarte && !modelType.equals(ModelType.service)) { + return this.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, + vnfType); + } else { + return this.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + } } } @@ -236,6 +241,25 @@ public class BBInputSetup implements JavaDelegate { throw new Exception("Could not find relevant information for related Service Instance"); } } + + protected GeneralBuildingBlock getGBBCM(ExecuteBuildingBlock executeBB, + RequestDetails requestDetails, Map<ResourceKey, String> lookupKeyMap, String requestAction, + String resourceId) throws Exception { + ServiceInstance serviceInstance = new ServiceInstance(); + String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID); + serviceInstance.setServiceInstanceId(serviceInstanceId); + + List<GenericVnf> genericVnfs = serviceInstance.getVnfs(); + + String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID); + org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId); + + GenericVnf genericVnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnf); + genericVnfs.add(genericVnf); + + return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, new Customer()); + + } protected void populateObjectsOnAssignAndCreateFlows(RequestDetails requestDetails, Service service, String bbName, ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String vnfType) @@ -790,7 +814,9 @@ public class BBInputSetup implements JavaDelegate { customer = mapCustomer(globalCustomerId, subscriptionServiceType); } outputBB.setServiceInstance(serviceInstance); - customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + if (customer.getServiceSubscription() != null) { + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + } outputBB.setCustomer(customer); return outputBB; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index 877d5bb88f..0c7eb0973f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -341,6 +341,7 @@ public class BBInputSetupMapperLayer { requestParams.setaLaCarte(requestParameters.getALaCarte()); requestParams.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType()); requestParams.setUserParams(requestParameters.getUserParams()); + requestParams.setPayload(requestParameters.getPayload()); return requestParams; } diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn index 67bd961844..63c867f3c7 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="CompleteMsoProcess" name="CompleteMsoProcess" isExecutable="true"> <bpmn2:scriptTask id="preProcessRequest" name="Pre-Process Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_18</bpmn2:incoming> @@ -56,6 +56,7 @@ completeMsoProcess.setUpdateDBstatustoSuccessPayload(execution)]]></bpmn2:script <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> <camunda:entry key="Authorization">#{BasicAuthHeaderValueDB}</camunda:entry> + <camunda:entry key="X-ONAP-RequestID">#{CMSO_request_id}</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="method">POST</camunda:inputParameter> @@ -88,7 +89,7 @@ buildDataErrorMessage.buildDataError(execution, "Complete MSO -- Update DB stat <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="ExclusiveGateway_7" targetRef="BuildErrorMessage" /> <bpmn2:boundaryEvent id="BoundaryEvent_7" name="" attachedToRef="updateInfraRequest"> <bpmn2:outgoing>SequenceFlow_0mipf25</bpmn2:outgoing> - <bpmn2:errorEventDefinition id="_ErrorEventDefinition_84" errorRef="Error_1" /> + <bpmn2:errorEventDefinition id="_ErrorEventDefinition_84" errorRef="Error_1" camunda:errorCodeVariable="gJavaErrorCode" camunda:errorMessageVariable="gJavaErrorMessage" /> </bpmn2:boundaryEvent> <bpmn2:endEvent id="EndEvent_1"> <bpmn2:incoming>SequenceFlow_1pzb94j</bpmn2:incoming> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn index c59564b1e3..990863ec93 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_3SPHsLr9EeWak-hhutJWuQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_3SPHsLr9EeWak-hhutJWuQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="FalloutHandler" name="Fallout Handler" isExecutable="true"> <bpmn2:parallelGateway id="ParallelGateway_1"> <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming> @@ -139,6 +139,7 @@ falloutHandler.buildDBWorkflowException(execution, "FH_updateRequestInfraRespons <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> <camunda:entry key="Authorization">#{BasicAuthHeaderValueDB}</camunda:entry> + <camunda:entry key="X-ONAP-RequestID">#{FH_request_id}</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload"> @@ -168,7 +169,7 @@ return updateRequestInfra.updateRequestInfraPayload(execution)]]></camunda:scrip </bpmn2:sequenceFlow> <bpmn2:boundaryEvent id="BoundaryEvent_3" name="Connect Fault" attachedToRef="ServiceTask_2"> <bpmn2:outgoing>SequenceFlow_80</bpmn2:outgoing> - <bpmn2:errorEventDefinition id="_ErrorEventDefinition_90" errorRef="Error_2" /> + <bpmn2:errorEventDefinition id="_ErrorEventDefinition_90" errorRef="Error_2" camunda:errorCodeVariable="gJavaErrorCode" camunda:errorMessageVariable="gJavaErrorMessage" /> </bpmn2:boundaryEvent> <bpmn2:sequenceFlow id="SequenceFlow_80" name="" sourceRef="BoundaryEvent_3" targetRef="ScriptTask_7" /> <bpmn2:subProcess id="SubProcess_1" name="Event Handler" triggeredByEvent="true"> diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy index 9b3b8c2fb0..e065ccd14f 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy @@ -22,28 +22,12 @@ package org.onap.so.bpmn.common.scripts import com.github.tomakehurst.wiremock.junit.WireMockRule -import static org.junit.Assert.*; import static org.mockito.Mockito.* - -import org.onap.so.rest.HttpHeader -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.mockito.internal.debugging.MockitoDebuggerImpl -import org.junit.Before -import org.onap.so.bpmn.common.scripts.AaiUtil; -import org.junit.Rule; -import org.junit.Test -import org.junit.Ignore -import org.junit.runner.RunWith -import org.junit.Before; -import org.junit.Test; import org.camunda.bpm.engine.ProcessEngineServices import org.camunda.bpm.engine.RepositoryService import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl import org.camunda.bpm.engine.repository.ProcessDefinition import org.junit.Assert -import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith @@ -51,16 +35,18 @@ import org.mockito.ArgumentCaptor import org.mockito.Captor import org.mockito.Mockito import org.mockito.runners.MockitoJUnitRunner -import org.onap.so.bpmn.common.scripts.ConfirmVolumeGroupName import org.onap.so.bpmn.core.WorkflowException import static com.github.tomakehurst.wiremock.client.WireMock.* -import static org.mockito.Mockito.* @RunWith(MockitoJUnitRunner.class) -@Ignore class ConfirmVolumeGroupNameTest extends MsoGroovyTest { + private static final def AAA_URI = "uri_test" + private static final def AIC_CLOUD_REGION = "AicClReg_test" + private static final def VOLUME_GROUP_NAME = "volumeTestGName" + private static final def VOLUME_GROUP_ID = "vol_gr_id_test" + @Captor ArgumentCaptor<ExecutionEntity> captor= ArgumentCaptor.forClass(ExecutionEntity.class); @@ -68,6 +54,60 @@ class ConfirmVolumeGroupNameTest extends MsoGroovyTest { public WireMockRule wireMockRule = new WireMockRule(8090); @Test + void preProcessRequestSuccessful() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("ConfirmVolumeGroupName_volumeGroupId")).thenReturn(VOLUME_GROUP_ID) + when(mockExecution.getVariable("ConfirmVolumeGroupName_volumeGroupName")).thenReturn(VOLUME_GROUP_NAME) + when(mockExecution.getVariable("ConfirmVolumeGroupName_aicCloudRegion")).thenReturn(AIC_CLOUD_REGION) + + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('namespace_test') + when(mockExecution.getVariable("mso.workflow.ConfirmVolumeGroupName.aai.cloud-region.uri")).thenReturn(AAA_URI) + new ConfirmVolumeGroupName().preProcessRequest(mockExecution) + + verifyInitProcessVariables(mockExecution) + verify(mockExecution).setVariable("CVGN_volumeGroupId", VOLUME_GROUP_ID) + verify(mockExecution).setVariable("CVGN_volumeGroupName", "volumeTestGName") + verify(mockExecution).setVariable("CVGN_aicCloudRegion", AIC_CLOUD_REGION) + verify(mockExecution).setVariable("CVGN_volumeGroupGetEndpoint", + "${AAA_URI}/${AIC_CLOUD_REGION}/volume-groups/volume-group/" + VOLUME_GROUP_ID) + } + + private void verifyInitProcessVariables(ExecutionEntity mockExecution) { + verify(mockExecution).setVariable("prefix", "CVGN_") + verify(mockExecution).setVariable("CVGN_volumeGroupId", null) + verify(mockExecution).setVariable("CVGN_volumeGroupName", null) + verify(mockExecution).setVariable("CVGN_aicCloudRegion", null) + verify(mockExecution).setVariable("CVGN_volumeGroupGetEndpoint", null) + verify(mockExecution).setVariable("CVGN_volumeGroupNameMatches", false) + verify(mockExecution).setVariable("CVGN_queryVolumeGroupResponseCode", null) + verify(mockExecution).setVariable("CVGN_queryVolumeGroupResponse", "") + verify(mockExecution).setVariable("CVGN_ResponseCode", null) + verify(mockExecution).setVariable("RollbackData", null) + } + + @Test + void checkAAIQueryResult_volumeGroupNamesMatch() { + ExecutionEntity mockExecution = setupMock() + commonPartOfCheckAAIQueryTest(mockExecution, VOLUME_GROUP_NAME) + verify(mockExecution).setVariable("CVGN_volumeGroupNameMatches", true) + } + + @Test + void checkAAIQueryResult_volumeGroupNamesDoNotMatch() { + ExecutionEntity mockExecution = setupMock() + commonPartOfCheckAAIQueryTest(mockExecution, "grName2") + verify(mockExecution, Mockito.times(0)).setVariable("CVGN_volumeGroupNameMatches", true) + } + + private void commonPartOfCheckAAIQueryTest(ExecutionEntity mockExecution, def volumeGroupName) { + when(mockExecution.getVariable("CVGN_volumeGroupName")).thenReturn(VOLUME_GROUP_NAME) + def xml = "<volume-group-name>" + volumeGroupName + "</volume-group-name>" + when(mockExecution.getVariable("CVGN_queryVolumeGroupResponse")).thenReturn(xml) + new ConfirmVolumeGroupName().checkAAIQueryResult(mockExecution) + verify(mockExecution).setVariable("CVGN_volumeGroupNameMatches", false) + } + + @Test public void testQueryAAIForVolumeGroupId() { ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable("aai.endpoint")).thenReturn('http://localhost:8090') diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index 9897c04ad8..d0ecedf878 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -301,6 +301,35 @@ public class BBInputSetupTest { assertThat(actual, sameBeanAs(expected)); } + + @Test + public void testGetGBBCM() throws Exception { + GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockCMExpected.json"), + GeneralBuildingBlock.class); + + ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock(); + executeBB.setRequestId("requestId"); + RequestDetails requestDetails = new RequestDetails(); + requestDetails.setModelInfo(null); + RequestParameters requestParams = new RequestParameters(); + requestParams.setaLaCarte(true); + requestDetails.setRequestParameters(requestParams); + RequestInfo requestInfo = new RequestInfo(); + requestInfo.setSuppressRollback(true); + requestDetails.setRequestInfo(requestInfo); + doReturn(requestDetails).when(SPY_bbInputSetupUtils).getRequestDetails(executeBB.getRequestId()); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + String resourceId = "123"; + String requestAction = "createInstance"; + doReturn(expected).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doNothing().when(SPY_bbInputSetup).populateLookupKeyMapWithIds(any(WorkflowResourceIds.class), any()); + doReturn(null).when(bbInputSetupMapperLayer).mapAAIGenericVnfIntoGenericVnf(any(org.onap.aai.domain.yang.GenericVnf.class)); + GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBCM(executeBB, requestDetails, lookupKeyMap, requestAction, + resourceId); + + assertThat(actual, sameBeanAs(expected)); + } @Test public void testGetGBBALaCarteNonService() throws Exception { diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json new file mode 100644 index 0000000000..8cd04fdd8e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json @@ -0,0 +1,29 @@ +{ + "requestContext": { + "source": "VID", + "mso-request-id": "requestId", + "action": "createInstance", + "requestParameters": { + "userParams": [], + "aLaCarte": true + }, + "configurationParameters": [] + }, + "orchContext": { + "is-rollback-enabled": true + }, + "cloudRegion": { + "cloud-owner": "att-aic" + }, + "userInput": null, + "customer": { + "vpn-bindings": [] + }, + "serviceInstance": { + "vnfs": [null], + "pnfs": [], + "allotted-resources": [], + "networks": [], + "configurations": [] + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java index da24ba14fd..9ea97258ef 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java @@ -31,7 +31,6 @@ import org.camunda.bpm.engine.variable.impl.VariableMapImpl; import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; import org.onap.so.logger.MsoLogger; import org.openecomp.mso.bpmn.common.workflow.service.WorkflowProcessorException; -import org.slf4j.MDC; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -46,19 +45,14 @@ public class WorkflowProcessor extends ProcessEngineAwareService { @Async public void startProcess( String processKey, VariableMapImpl variableMap) throws InterruptedException { - MDC.getCopyOfContextMap(); + long startTime = System.currentTimeMillis(); Map<String, Object> inputVariables = null; String processInstanceId = null; try { inputVariables = getInputVariables(variableMap); - setLogContext(processKey, inputVariables); - // This variable indicates that the flow was invoked asynchronously inputVariables.put("isAsyncProcess", "true"); - - - setLogContext(processKey, inputVariables); // Note: this creates a random businessKey if it wasn't specified. String businessKey = getBusinessKey(inputVariables); @@ -87,14 +81,6 @@ public class WorkflowProcessor extends ProcessEngineAwareService { } } - protected static void setLogContext(String processKey, - Map<String, Object> inputVariables) { - MsoLogger.setServiceName("MSO." + processKey); - if (inputVariables != null) { - MsoLogger.setLogContext(getKeyValueFromInputVariables(inputVariables,"mso-request-id"), getKeyValueFromInputVariables(inputVariables,"mso-service-instance-id")); - } - } - protected static String getKeyValueFromInputVariables(Map<String,Object> inputVariables, String key) { if (inputVariables == null) { return ""; diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java index 00ee6eb235..9b65cca6c9 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java @@ -70,9 +70,7 @@ import org.springframework.stereotype.Component; * Plugin for MSO logging and URN mapping. */ @Component -public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { - private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, LoggingAndURNMappingPlugin.class); - private static final String FSPROPKEY = "URNMapping.FileSystemLoading.Enabled"; +public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { @Autowired private LoggingParseListener loggingParseListener; @@ -198,7 +196,6 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { @Override public void parseSequenceFlow(Element sequenceFlowElement, ScopeImpl scopeElement, TransitionImpl transition) { - //injectLogExecutionListener(activity); } @Override @@ -216,9 +213,9 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { injectLogExecutionListener(timerActivity); } - @Override + @Override public void parseRootElement(Element rootElement, List<ProcessDefinitionEntity> processDefinitions) { - //injectLogExecutionListener(activity); + } @Override @@ -298,17 +295,7 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { } @Override - public void notify(DelegateExecution execution) throws Exception { - logger.trace("Logging for activity---------------:" + event + ":" - + execution.getCurrentActivityName() - + ", processDefinitionId=" - + execution.getProcessDefinitionId() + ", activtyId=" - + execution.getCurrentActivityId() + ", activtyName='" - + execution.getCurrentActivityName() + "'" - + ", processInstanceId=" - + execution.getProcessInstanceId() + ", businessKey=" - + execution.getProcessBusinessKey() + ", executionId=" - + execution.getId()); + public void notify(DelegateExecution execution) throws Exception { //required for legacy groovy processing in camunda execution.setVariable("isDebugLogEnabled", "true"); if (!isBlank(execution.getCurrentActivityName())) { @@ -322,20 +309,7 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { .singleResult() .getName(); - if (execution.getBpmnModelElementInstance() instanceof StartEvent) { - logger.debug("Starting process: " + processName); - } - if (execution.getBpmnModelElementInstance() instanceof EndEvent) { - logger.debug("Ending process: " + processName); - } - - String serviceName = MDC.get(MsoLogger.SERVICE_NAME); - - if(serviceName != null && !serviceName.contains(processName)) - MsoLogger.setServiceName( serviceName + "." + processName); - else if(serviceName == null) - MsoLogger.setServiceName(processName); - + MsoLogger.setServiceName(processName); String requestId = (String) execution.getVariable("mso-request-id"); String svcid = (String) execution.getVariable("mso-service-instance-id"); MsoLogger.setLogContext(requestId, svcid); diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java index db2304d6b7..efd73ba4f2 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java @@ -30,6 +30,8 @@ import org.camunda.bpm.engine.ProcessEngine; import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; import org.onap.so.logger.MsoLogger; +import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -102,7 +104,7 @@ public class MSOInfrastructureApplication { @Primary public Executor asyncExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); - + executor.setTaskDecorator(new MDCTaskDecorator()); executor.setCorePoolSize(corePoolSize); executor.setMaxPoolSize(maxPoolSize); executor.setQueueCapacity(queueCapacity); diff --git a/bpmn/pom.xml b/bpmn/pom.xml index ebf4481fdb..4e36b775f5 100644 --- a/bpmn/pom.xml +++ b/bpmn/pom.xml @@ -18,7 +18,6 @@ <camunda.version>7.8.0</camunda.version> <camunda.bpm.assert.version>1.2</camunda.bpm.assert.version> <camunda.bpm.webapp.artifact>camunda-webapp-jboss-standalone</camunda.bpm.webapp.artifact> - <h2.version>1.4.196</h2.version> <groovy.version>2.4.8</groovy.version> <saxon.version>9.5.1-8</saxon.version> <xmlunit.version>2.4.0</xmlunit.version> @@ -43,11 +42,6 @@ <dependencyManagement> <dependencies> <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <version>${h2.version}</version> - </dependency> - <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>${groovy.version}</version> diff --git a/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java b/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java new file mode 100644 index 0000000000..db1f7cb6f9 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java @@ -0,0 +1,103 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.activity; + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.Paths; + +import javax.ws.rs.core.UriBuilder; + +import org.apache.http.HttpResponse; +import org.apache.http.StatusLine; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.HttpClientBuilder; +import org.springframework.stereotype.Component; + +@Component +public class DeployActivitySpecs { + private static final String ACTIVITY_FILE_LOCATION = "src/main/resources/ActivitySpec/"; + private static final String ACTIVITY_SPEC_URI = "/activityspec-api/v1.0/activity-spec"; + private static final String CONTENT_TYPE_JSON = "application/json"; + + public static void main(String[] args) throws Exception { + + if (args == null || args.length == 0) { + System.out.println("Please specify hostname argument"); + return; + } + + String hostname = args[0]; + + File dir = new File(ACTIVITY_FILE_LOCATION); + if (!dir.isDirectory()) { + System.out.println("ActivitySpec store is not a directory"); + return; + } + + for (File f : dir.listFiles()) { + String activitySpecName = f.getName(); + String errorMessage = deployActivitySpec(hostname, activitySpecName); + if (errorMessage == null) { + System.out.println("Deployed Activity Spec: " + activitySpecName); + } + else { + System.out.println("Error deploying Activity Spec: " + activitySpecName + " : " + errorMessage); + } + } + return; + } + + protected static String deployActivitySpec(String hostname, String activitySpecName) throws Exception { + String payload = new String(Files.readAllBytes(Paths.get(ACTIVITY_FILE_LOCATION + activitySpecName))); + try { + HttpClient client = HttpClientBuilder.create().build(); + + String url = UriBuilder.fromUri(hostname).path(ACTIVITY_SPEC_URI).build().toString(); + HttpPost post = new HttpPost(url); + + StringEntity input = new StringEntity(payload); + input.setContentType(CONTENT_TYPE_JSON); + post.setEntity(input); + + HttpResponse response = client.execute(post); + StatusLine statusLine = response.getStatusLine(); + + if (statusLine != null) { + if (statusLine.getStatusCode() != 200) { + return (statusLine.toString()); + } + else { + return null; + } + } + else { + return("Empty response from the remote endpoint"); + } + + } catch (Exception e) { + return e.getMessage(); + } + + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/FlowCompleteActivitySpec.json b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/FlowCompleteActivitySpec.json new file mode 100644 index 0000000000..e031c85501 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/FlowCompleteActivitySpec.json @@ -0,0 +1,14 @@ +{ + "name": "FlowCompleteActivity", + "description": "Activity to Complete the BPMN Flow", + "categoryList": [ + "VNF" + ], + "inputParameters": [ + { + "name": "WorkflowException", + "type": "WorkflowException" + } + ], + "outputParameters": [] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFHealthCheckActivitySpec.json b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFHealthCheckActivitySpec.json new file mode 100644 index 0000000000..9f278b20c1 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFHealthCheckActivitySpec.json @@ -0,0 +1,14 @@ +{ + "name": "VNFHealthCheckActivity", + "description": "Activity to HealthCheck VNF", + "categoryList": [ + "VNF" + ], + "inputParameters": [], + "outputParameters": [ + { + "name": "WorkflowException", + "type": "WorkflowException" + } + ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFQuiesceTrafficActivitySpec.json b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFQuiesceTrafficActivitySpec.json new file mode 100644 index 0000000000..c64098dcea --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFQuiesceTrafficActivitySpec.json @@ -0,0 +1,14 @@ +{ + "name": "VNFQuiesceTrafficActivity", + "description": "Activity to QuiesceTraffic on VNF", + "categoryList": [ + "VNF" + ], + "inputParameters": [], + "outputParameters": [ + { + "name": "WorkflowException", + "type": "WorkflowException" + } + ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFResumeTrafficActivitySpec.json b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFResumeTrafficActivitySpec.json new file mode 100644 index 0000000000..6527f2e66d --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFResumeTrafficActivitySpec.json @@ -0,0 +1,14 @@ +{ + "name": "VNFResumeTrafficActivity", + "description": "Activity to ResumeTraffic on VNF", + "categoryList": [ + "VNF" + ], + "inputParameters": [], + "outputParameters": [ + { + "name": "WorkflowException", + "type": "WorkflowException" + } + ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFSetInMaintFlagActivitySpec.json b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFSetInMaintFlagActivitySpec.json new file mode 100644 index 0000000000..8f3211c9a9 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFSetInMaintFlagActivitySpec.json @@ -0,0 +1,14 @@ +{ + "name": "VNFSetInMaintFlagActivity", + "description": "Activity to Set InMaint Flag in A&AI", + "categoryList": [ + "VNF" + ], + "inputParameters": [], + "outputParameters": [ + { + "name": "WorkflowException", + "type": "WorkflowException" + } + ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUnsetInMaintFlagActivitySpec.json b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUnsetInMaintFlagActivitySpec.json new file mode 100644 index 0000000000..1c3f862fec --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUnsetInMaintFlagActivitySpec.json @@ -0,0 +1,14 @@ +{ + "name": "VNFUnsetInMaintFlagActivity", + "description": "Activity to Unset InMaint Flag in A&AI", + "categoryList": [ + "VNF" + ], + "inputParameters": [], + "outputParameters": [ + { + "name": "WorkflowException", + "type": "WorkflowException" + } + ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUpgradePostCheckActivitySpec.json b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUpgradePostCheckActivitySpec.json new file mode 100644 index 0000000000..722fd6e667 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUpgradePostCheckActivitySpec.json @@ -0,0 +1,14 @@ +{ + "name": "VNFUpgradePostCheckActivity", + "description": "Activity to UpgradePostCheck on VNF", + "categoryList": [ + "VNF" + ], + "inputParameters": [], + "outputParameters": [ + { + "name": "WorkflowException", + "type": "WorkflowException" + } + ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUpgradePreCheckActivitySpec.json b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUpgradePreCheckActivitySpec.json new file mode 100644 index 0000000000..bae912ee3b --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUpgradePreCheckActivitySpec.json @@ -0,0 +1,14 @@ +{ + "name": "VNFUpgradePreCheckActivity", + "description": "Activity to UpgradePreCheck on VNF", + "categoryList": [ + "VNF" + ], + "inputParameters": [], + "outputParameters": [ + { + "name": "WorkflowException", + "type": "WorkflowException" + } + ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUpgradeSoftwareActivitySpec.json b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUpgradeSoftwareActivitySpec.json new file mode 100644 index 0000000000..606fa6cd1f --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUpgradeSoftwareActivitySpec.json @@ -0,0 +1,14 @@ +{ + "name": "VNFUpgradeSoftwareActivity", + "description": "Activity to UpgradeSoftware on VNF", + "categoryList": [ + "VNF" + ], + "inputParameters": [], + "outputParameters": [ + { + "name": "WorkflowException", + "type": "WorkflowException" + } + ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/FlowCompleteActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/FlowCompleteActivity.bpmn new file mode 100644 index 0000000000..e255689e75 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/FlowCompleteActivity.bpmn @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> + <bpmn:process id="FlowCompleteActivity" name="FlowCompleteActivity" isExecutable="true"> + <bpmn:startEvent id="FlowCompleteActivity_Start"> + <bpmn:outgoing>SequenceFlow_1tbhm2c</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="FlowCompleteActivity_End"> + <bpmn:incoming>SequenceFlow_10spt85</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1tbhm2c" sourceRef="FlowCompleteActivity_Start" targetRef="TaskUpdateRequestDB" /> + <bpmn:sequenceFlow id="SequenceFlow_10spt85" sourceRef="TaskUpdateRequestDB" targetRef="FlowCompleteActivity_End" /> + <bpmn:serviceTask id="TaskUpdateRequestDB" name="Update Request DB with Status" camunda:expression="${FlowCompletionTasks.updateRequestDbStatus(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_1tbhm2c</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_10spt85</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="FlowCompleteActivity"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="FlowCompleteActivity_Start"> + <dc:Bounds x="173" y="102" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0uee341_di" bpmnElement="FlowCompleteActivity_End"> + <dc:Bounds x="428" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="446" y="138" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1tbhm2c_di" bpmnElement="SequenceFlow_1tbhm2c"> + <di:waypoint xsi:type="dc:Point" x="209" y="120" /> + <di:waypoint xsi:type="dc:Point" x="264" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="237" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_10spt85_di" bpmnElement="SequenceFlow_10spt85"> + <di:waypoint xsi:type="dc:Point" x="364" y="120" /> + <di:waypoint xsi:type="dc:Point" x="394" y="120" /> + <di:waypoint xsi:type="dc:Point" x="394" y="120" /> + <di:waypoint xsi:type="dc:Point" x="428" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="409" y="120" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0f1gnqq_di" bpmnElement="TaskUpdateRequestDB"> + <dc:Bounds x="264" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFHealthCheckActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFHealthCheckActivity.bpmn new file mode 100644 index 0000000000..2e97206867 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFHealthCheckActivity.bpmn @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> + <bpmn:process id="VNFHealthCheckActivity" name="VNFHealthCheckActivity" isExecutable="true"> + <bpmn:startEvent id="VNFHealthCheckActivity_Start"> + <bpmn:outgoing>SequenceFlow_06vhbci</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="VNFHealthCheckActivity_End"> + <bpmn:incoming>SequenceFlow_01312aj</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_06vhbci" sourceRef="VNFHealthCheckActivity_Start" targetRef="TaskPreProcessActivity" /> + <bpmn:sequenceFlow id="SequenceFlow_01312aj" sourceRef="TaskHealthCheck" targetRef="VNFHealthCheckActivity_End" /> + <bpmn:serviceTask id="TaskHealthCheck" name="VNF Health Check" camunda:expression="${AppcRunTasks.runAppcCommand(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")),execution.getVariable("actionHealthCheck"))}"> + <bpmn:incoming>SequenceFlow_0cf0riu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01312aj</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0cf0riu" sourceRef="TaskPreProcessActivity" targetRef="TaskHealthCheck" /> + <bpmn:serviceTask id="TaskPreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcRunTasks.preProcessActivity(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_06vhbci</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0cf0riu</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFHealthCheckActivity"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFHealthCheckActivity_Start"> + <dc:Bounds x="173" y="102" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_102xlzi_di" bpmnElement="VNFHealthCheckActivity_End"> + <dc:Bounds x="561" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="579" y="138" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_06vhbci_di" bpmnElement="SequenceFlow_06vhbci"> + <di:waypoint xsi:type="dc:Point" x="209" y="120" /> + <di:waypoint xsi:type="dc:Point" x="255" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="232" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01312aj_di" bpmnElement="SequenceFlow_01312aj"> + <di:waypoint xsi:type="dc:Point" x="497" y="120" /> + <di:waypoint xsi:type="dc:Point" x="561" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="529" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_066idx4_di" bpmnElement="TaskHealthCheck"> + <dc:Bounds x="397" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0cf0riu_di" bpmnElement="SequenceFlow_0cf0riu"> + <di:waypoint xsi:type="dc:Point" x="355" y="120" /> + <di:waypoint xsi:type="dc:Point" x="397" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="376" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0fti66x_di" bpmnElement="TaskPreProcessActivity"> + <dc:Bounds x="255" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFQuiesceTrafficActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFQuiesceTrafficActivity.bpmn new file mode 100644 index 0000000000..ac09674884 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFQuiesceTrafficActivity.bpmn @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> + <bpmn:process id="VNFQuiesceTrafficActivity" name="VNFQuiesceTrafficActivity" isExecutable="true"> + <bpmn:startEvent id="VNFQuiesceTrafficActivity_Start"> + <bpmn:outgoing>SequenceFlow_06vhbci</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="VNFQuiesceTrafficActivity_End"> + <bpmn:incoming>SequenceFlow_01312aj</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_06vhbci" sourceRef="VNFQuiesceTrafficActivity_Start" targetRef="TaskPreProcessActivity" /> + <bpmn:sequenceFlow id="SequenceFlow_01312aj" sourceRef="TaskQuiesceTraffic" targetRef="VNFQuiesceTrafficActivity_End" /> + <bpmn:serviceTask id="TaskQuiesceTraffic" name="VNF Quiesce Traffic" camunda:expression="${AppcRunTasks.runAppcCommand(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")),execution.getVariable("actionQuiesceTraffic"))}"> + <bpmn:incoming>SequenceFlow_0cf0riu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01312aj</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0cf0riu" sourceRef="TaskPreProcessActivity" targetRef="TaskQuiesceTraffic" /> + <bpmn:serviceTask id="TaskPreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcRunTasks.preProcessActivity(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_06vhbci</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0cf0riu</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFQuiesceTrafficActivity"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFQuiesceTrafficActivity_Start"> + <dc:Bounds x="173" y="102" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_102xlzi_di" bpmnElement="VNFQuiesceTrafficActivity_End"> + <dc:Bounds x="561" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="579" y="138" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_06vhbci_di" bpmnElement="SequenceFlow_06vhbci"> + <di:waypoint xsi:type="dc:Point" x="209" y="120" /> + <di:waypoint xsi:type="dc:Point" x="255" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="232" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01312aj_di" bpmnElement="SequenceFlow_01312aj"> + <di:waypoint xsi:type="dc:Point" x="497" y="120" /> + <di:waypoint xsi:type="dc:Point" x="561" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="529" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_066idx4_di" bpmnElement="TaskQuiesceTraffic"> + <dc:Bounds x="397" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0cf0riu_di" bpmnElement="SequenceFlow_0cf0riu"> + <di:waypoint xsi:type="dc:Point" x="355" y="120" /> + <di:waypoint xsi:type="dc:Point" x="397" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="376" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0fti66x_di" bpmnElement="TaskPreProcessActivity"> + <dc:Bounds x="255" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFResumeTrafficActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFResumeTrafficActivity.bpmn new file mode 100644 index 0000000000..c21072a32a --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFResumeTrafficActivity.bpmn @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> + <bpmn:process id="VNFResumeTrafficActivity" name="VNFResumeTrafficActivity" isExecutable="true"> + <bpmn:startEvent id="VNFResumeTrafficActivity_Start"> + <bpmn:outgoing>SequenceFlow_06vhbci</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="VNFResumeTrafficActivity_End"> + <bpmn:incoming>SequenceFlow_01312aj</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_06vhbci" sourceRef="VNFResumeTrafficActivity_Start" targetRef="TaskPreProcessActivity" /> + <bpmn:sequenceFlow id="SequenceFlow_01312aj" sourceRef="TaskResumeTraffic" targetRef="VNFResumeTrafficActivity_End" /> + <bpmn:serviceTask id="TaskResumeTraffic" name="VNF Resume Traffic" camunda:expression="${AppcRunTasks.runAppcCommand(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")),execution.getVariable("actionResumeTraffic"))}"> + <bpmn:incoming>SequenceFlow_0cf0riu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01312aj</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0cf0riu" sourceRef="TaskPreProcessActivity" targetRef="TaskResumeTraffic" /> + <bpmn:serviceTask id="TaskPreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcRunTasks.preProcessActivity(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_06vhbci</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0cf0riu</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFResumeTrafficActivity"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFResumeTrafficActivity_Start"> + <dc:Bounds x="173" y="102" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_102xlzi_di" bpmnElement="VNFResumeTrafficActivity_End"> + <dc:Bounds x="561" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="579" y="138" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_06vhbci_di" bpmnElement="SequenceFlow_06vhbci"> + <di:waypoint xsi:type="dc:Point" x="209" y="120" /> + <di:waypoint xsi:type="dc:Point" x="255" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="232" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01312aj_di" bpmnElement="SequenceFlow_01312aj"> + <di:waypoint xsi:type="dc:Point" x="497" y="120" /> + <di:waypoint xsi:type="dc:Point" x="561" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="529" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_066idx4_di" bpmnElement="TaskResumeTraffic"> + <dc:Bounds x="397" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0cf0riu_di" bpmnElement="SequenceFlow_0cf0riu"> + <di:waypoint xsi:type="dc:Point" x="355" y="120" /> + <di:waypoint xsi:type="dc:Point" x="397" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="376" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0fti66x_di" bpmnElement="TaskPreProcessActivity"> + <dc:Bounds x="255" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSetInMaintFlagActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSetInMaintFlagActivity.bpmn new file mode 100644 index 0000000000..2bdb1d7533 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSetInMaintFlagActivity.bpmn @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> + <bpmn:process id="VNFSetInMaintFlagActivity" name="VNFSetInMaintFlagActivity " isExecutable="true"> + <bpmn:startEvent id="VNFSetInMaintFlagActivity_Start"> + <bpmn:outgoing>SequenceFlow_0zaz9o2</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="VNFSetInMaintFlagActivity_End"> + <bpmn:incoming>SequenceFlow_1jwsja5</bpmn:incoming> + </bpmn:endEvent> + <bpmn:serviceTask id="TaskSetInMaint" name="VNF Set InMaint Flag (AAI)" camunda:expression="${AAIFlagTasks.modifyVnfInMaintFlag(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")), true)}"> + <bpmn:incoming>SequenceFlow_0zaz9o2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1jwsja5</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0zaz9o2" sourceRef="VNFSetInMaintFlagActivity_Start" targetRef="TaskSetInMaint" /> + <bpmn:sequenceFlow id="SequenceFlow_1jwsja5" sourceRef="TaskSetInMaint" targetRef="VNFSetInMaintFlagActivity_End" /> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFSetInMaintFlagActivity"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFSetInMaintFlagActivity_Start"> + <dc:Bounds x="104" y="76" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="122" y="112" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1h93h9d_di" bpmnElement="VNFSetInMaintFlagActivity_End"> + <dc:Bounds x="320" y="76" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="338" y="116" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1r380lg_di" bpmnElement="TaskSetInMaint"> + <dc:Bounds x="192" y="54" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0zaz9o2_di" bpmnElement="SequenceFlow_0zaz9o2"> + <di:waypoint xsi:type="dc:Point" x="140" y="94" /> + <di:waypoint xsi:type="dc:Point" x="192" y="94" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="166" y="73" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1jwsja5_di" bpmnElement="SequenceFlow_1jwsja5"> + <di:waypoint xsi:type="dc:Point" x="292" y="94" /> + <di:waypoint xsi:type="dc:Point" x="320" y="94" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="306" y="79" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetInMaintFlagActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetInMaintFlagActivity.bpmn new file mode 100644 index 0000000000..05d3fcfa27 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetInMaintFlagActivity.bpmn @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> + <bpmn:process id="VNFUnsetInMaintFlagActivity" name="VNFUnsetInMaintFlagActivity " isExecutable="true"> + <bpmn:startEvent id="VNFUnsetInMaintFlagActivity_Start"> + <bpmn:outgoing>SequenceFlow_0zaz9o2</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="VNFUnsetInMaintFlagActivity_End"> + <bpmn:incoming>SequenceFlow_1jwsja5</bpmn:incoming> + </bpmn:endEvent> + <bpmn:serviceTask id="TaskUnsetInMaint" name="VNF UnSet InMaint Flag (AAI)" camunda:expression="${AAIFlagTasks.modifyVnfInMaintFlag(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")), false)}"> + <bpmn:incoming>SequenceFlow_0zaz9o2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1jwsja5</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0zaz9o2" sourceRef="VNFUnsetInMaintFlagActivity_Start" targetRef="TaskUnsetInMaint" /> + <bpmn:sequenceFlow id="SequenceFlow_1jwsja5" sourceRef="TaskUnsetInMaint" targetRef="VNFUnsetInMaintFlagActivity_End" /> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFUnsetInMaintFlagActivity"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFUnsetInMaintFlagActivity_Start"> + <dc:Bounds x="104" y="76" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="122" y="112" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1h93h9d_di" bpmnElement="VNFUnsetInMaintFlagActivity_End"> + <dc:Bounds x="320" y="76" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="338" y="116" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1r380lg_di" bpmnElement="TaskUnsetInMaint"> + <dc:Bounds x="192" y="54" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0zaz9o2_di" bpmnElement="SequenceFlow_0zaz9o2"> + <di:waypoint xsi:type="dc:Point" x="140" y="94" /> + <di:waypoint xsi:type="dc:Point" x="192" y="94" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="166" y="73" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1jwsja5_di" bpmnElement="SequenceFlow_1jwsja5"> + <di:waypoint xsi:type="dc:Point" x="292" y="94" /> + <di:waypoint xsi:type="dc:Point" x="320" y="94" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="306" y="79" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradePostCheckActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradePostCheckActivity.bpmn new file mode 100644 index 0000000000..56c24dabc9 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradePostCheckActivity.bpmn @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> + <bpmn:process id="VNFUpgradePostCheckActivity" name="VNFUpgradePostCheckActivity" isExecutable="true"> + <bpmn:startEvent id="VNFUpgradePostCheckActivity_Start"> + <bpmn:outgoing>SequenceFlow_06vhbci</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="VNFUpgradePostCheckActivity_End"> + <bpmn:incoming>SequenceFlow_01312aj</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_06vhbci" sourceRef="VNFUpgradePostCheckActivity_Start" targetRef="TaskPreProcessActivity" /> + <bpmn:sequenceFlow id="SequenceFlow_01312aj" sourceRef="TaskUpgradePostCheck" targetRef="VNFUpgradePostCheckActivity_End" /> + <bpmn:serviceTask id="TaskUpgradePostCheck" name="VNF Upgrade PostCheck " camunda:expression="${AppcRunTasks.runAppcCommand(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")),execution.getVariable("actionUpgradePostCheck"))}"> + <bpmn:incoming>SequenceFlow_0cf0riu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01312aj</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0cf0riu" sourceRef="TaskPreProcessActivity" targetRef="TaskUpgradePostCheck" /> + <bpmn:serviceTask id="TaskPreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcRunTasks.preProcessActivity(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_06vhbci</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0cf0riu</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFUpgradePostCheckActivity"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFUpgradePostCheckActivity_Start"> + <dc:Bounds x="173" y="102" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_102xlzi_di" bpmnElement="VNFUpgradePostCheckActivity_End"> + <dc:Bounds x="561" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="579" y="138" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_06vhbci_di" bpmnElement="SequenceFlow_06vhbci"> + <di:waypoint xsi:type="dc:Point" x="209" y="120" /> + <di:waypoint xsi:type="dc:Point" x="255" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="232" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01312aj_di" bpmnElement="SequenceFlow_01312aj"> + <di:waypoint xsi:type="dc:Point" x="497" y="120" /> + <di:waypoint xsi:type="dc:Point" x="561" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="529" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_066idx4_di" bpmnElement="TaskUpgradePostCheck"> + <dc:Bounds x="397" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0cf0riu_di" bpmnElement="SequenceFlow_0cf0riu"> + <di:waypoint xsi:type="dc:Point" x="355" y="120" /> + <di:waypoint xsi:type="dc:Point" x="397" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="376" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0fti66x_di" bpmnElement="TaskPreProcessActivity"> + <dc:Bounds x="255" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradePreCheckActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradePreCheckActivity.bpmn new file mode 100644 index 0000000000..1ec0a18dd5 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradePreCheckActivity.bpmn @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> + <bpmn:process id="VNFUpgradePreCheckActivity" name="VNFUpgradePreCheckActivity" isExecutable="true"> + <bpmn:startEvent id="VNFUpgradePreCheckActivity_Start"> + <bpmn:outgoing>SequenceFlow_06vhbci</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="VNFUpgradePreCheckActivity_End"> + <bpmn:incoming>SequenceFlow_01312aj</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_06vhbci" sourceRef="VNFUpgradePreCheckActivity_Start" targetRef="TaskPreProcessActivity" /> + <bpmn:sequenceFlow id="SequenceFlow_01312aj" sourceRef="TaskUpgradePreCheck" targetRef="VNFUpgradePreCheckActivity_End" /> + <bpmn:serviceTask id="TaskUpgradePreCheck" name="VNF Upgrade PreCheck " camunda:expression="${AppcRunTasks.runAppcCommand(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")),execution.getVariable("actionUpgradePreCheck"))}"> + <bpmn:incoming>SequenceFlow_0cf0riu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01312aj</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0cf0riu" sourceRef="TaskPreProcessActivity" targetRef="TaskUpgradePreCheck" /> + <bpmn:serviceTask id="TaskPreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcRunTasks.preProcessActivity(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_06vhbci</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0cf0riu</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFUpgradePreCheckActivity"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFUpgradePreCheckActivity_Start"> + <dc:Bounds x="173" y="102" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_102xlzi_di" bpmnElement="VNFUpgradePreCheckActivity_End"> + <dc:Bounds x="561" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="579" y="138" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_06vhbci_di" bpmnElement="SequenceFlow_06vhbci"> + <di:waypoint xsi:type="dc:Point" x="209" y="120" /> + <di:waypoint xsi:type="dc:Point" x="255" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="232" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01312aj_di" bpmnElement="SequenceFlow_01312aj"> + <di:waypoint xsi:type="dc:Point" x="497" y="120" /> + <di:waypoint xsi:type="dc:Point" x="561" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="529" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_066idx4_di" bpmnElement="TaskUpgradePreCheck"> + <dc:Bounds x="397" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0cf0riu_di" bpmnElement="SequenceFlow_0cf0riu"> + <di:waypoint xsi:type="dc:Point" x="355" y="120" /> + <di:waypoint xsi:type="dc:Point" x="397" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="376" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0fti66x_di" bpmnElement="TaskPreProcessActivity"> + <dc:Bounds x="255" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradeSoftwareActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradeSoftwareActivity.bpmn new file mode 100644 index 0000000000..89481a5640 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradeSoftwareActivity.bpmn @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> + <bpmn:process id="VNFUpgradeSoftwareActivity" name="VNFUpgradeSoftwareActivity" isExecutable="true"> + <bpmn:startEvent id="VNFUpgradeSoftwareActivity_Start"> + <bpmn:outgoing>SequenceFlow_06vhbci</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="VNFUpgradeSoftwareActivity_End"> + <bpmn:incoming>SequenceFlow_01312aj</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_06vhbci" sourceRef="VNFUpgradeSoftwareActivity_Start" targetRef="TaskPreProcessActivity" /> + <bpmn:sequenceFlow id="SequenceFlow_01312aj" sourceRef="TaskUpgradeSoftware" targetRef="VNFUpgradeSoftwareActivity_End" /> + <bpmn:serviceTask id="TaskUpgradeSoftware" name="VNF Upgrade Software" camunda:expression="${AppcRunTasks.runAppcCommand(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")),execution.getVariable("actionUpgradeSoftware"))}"> + <bpmn:incoming>SequenceFlow_0cf0riu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01312aj</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0cf0riu" sourceRef="TaskPreProcessActivity" targetRef="TaskUpgradeSoftware" /> + <bpmn:serviceTask id="TaskPreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcRunTasks.preProcessActivity(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_06vhbci</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0cf0riu</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFUpgradeSoftwareActivity"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFUpgradeSoftwareActivity_Start"> + <dc:Bounds x="173" y="102" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_102xlzi_di" bpmnElement="VNFUpgradeSoftwareActivity_End"> + <dc:Bounds x="561" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="579" y="138" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_06vhbci_di" bpmnElement="SequenceFlow_06vhbci"> + <di:waypoint xsi:type="dc:Point" x="209" y="120" /> + <di:waypoint xsi:type="dc:Point" x="255" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="232" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01312aj_di" bpmnElement="SequenceFlow_01312aj"> + <di:waypoint xsi:type="dc:Point" x="497" y="120" /> + <di:waypoint xsi:type="dc:Point" x="561" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="529" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_066idx4_di" bpmnElement="TaskUpgradeSoftware"> + <dc:Bounds x="397" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0cf0riu_di" bpmnElement="SequenceFlow_0cf0riu"> + <di:waypoint xsi:type="dc:Point" x="355" y="120" /> + <di:waypoint xsi:type="dc:Point" x="397" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="376" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0fti66x_di" bpmnElement="TaskPreProcessActivity"> + <dc:Bounds x="255" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn index 8765bca20c..eaee5399e6 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn @@ -33,7 +33,7 @@ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("callHoming")}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_0v8d14a" sourceRef="Task_callHoming" targetRef="ExclusiveGateway_1blf52g" /> - <bpmn:callActivity id="Task_callHoming" name="Call Homing" calledElement="HomingV2"> + <bpmn:callActivity id="Task_callHoming" name="Call Homing" calledElement="HomingBB"> <bpmn:extensionElements> <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" /> <camunda:in source="mso-request-id" target="mso-request-id" /> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn new file mode 100644 index 0000000000..344b7d8761 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn @@ -0,0 +1,208 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="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" id="_vwRmIBsREeeIQtzUKIjH4g" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.16.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="HomingBB" name="Homing" isExecutable="true"> + <bpmn2:startEvent id="StartEvent_1"> + <bpmn2:outgoing>SequenceFlow_1x9usa6</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:scriptTask id="callSniro" name=" Call Sniro/Oof " scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1x9usa6</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0lc15i7</bpmn2:outgoing> + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* +if(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")).getVariable("homingService") == "oof"){ + OofHoming oofHoming = new OofHoming() + oofHoming.callOof(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution"))) +}else{ + SniroHomingV2 sniroHoming = new SniroHomingV2() + SniroHoming.callSniro(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution"))) +}</bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1x9usa6" sourceRef="StartEvent_1" targetRef="callSniro" /> + <bpmn2:subProcess id="bpmnErrorSubprocess" name="Error Handling Subprocess" triggeredByEvent="true"> + <bpmn2:endEvent id="EndEvent_07tjq3v"> + <bpmn2:incoming>SequenceFlow_1rf4vs8</bpmn2:incoming> + <bpmn2:terminateEventDefinition /> + </bpmn2:endEvent> + <bpmn2:startEvent id="StartEvent_1qiitb2"> + <bpmn2:outgoing>SequenceFlow_00nlh7l</bpmn2:outgoing> + <bpmn2:errorEventDefinition /> + </bpmn2:startEvent> + <bpmn2:scriptTask id="processMsoWorkflowException" name="Process Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_00nlh7l</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1rf4vs8</bpmn2:outgoing> + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processSubflowsBPMNException(execution)</bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1rf4vs8" sourceRef="processMsoWorkflowException" targetRef="EndEvent_07tjq3v" /> + <bpmn2:sequenceFlow id="SequenceFlow_00nlh7l" sourceRef="StartEvent_1qiitb2" targetRef="processMsoWorkflowException" /> + </bpmn2:subProcess> + <bpmn2:subProcess id="javaExceptionSubProcess" name="Java Exception Sub Process" triggeredByEvent="true"> + <bpmn2:scriptTask id="processJavaException" name="Process Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0kamg53</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1o7154s</bpmn2:outgoing> + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)</bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:startEvent id="StartEvent_1fbpeuw"> + <bpmn2:outgoing>SequenceFlow_0kamg53</bpmn2:outgoing> + <bpmn2:errorEventDefinition errorRef="Error_1lwpypa" /> + </bpmn2:startEvent> + <bpmn2:endEvent id="EndEvent_0jbvnr0"> + <bpmn2:incoming>SequenceFlow_1o7154s</bpmn2:incoming> + <bpmn2:terminateEventDefinition /> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_0kamg53" name="" sourceRef="StartEvent_1fbpeuw" targetRef="processJavaException" /> + <bpmn2:sequenceFlow id="SequenceFlow_1o7154s" name="" sourceRef="processJavaException" targetRef="EndEvent_0jbvnr0" /> + </bpmn2:subProcess> + <bpmn2:scriptTask id="processSniroHomingSolution" name=" Process Solution " scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1fipbmk</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_01apjvo</bpmn2:outgoing> + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* +if(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")).getVariable("homingService") == "oof"){ + OofHoming oofHoming = new OofHoming() + oofHoming.processHomingSolution(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution"))) +}else{ + SniroHomingV2 sniroHoming = new SniroHomingV2 () + sniroHoming.processSolution(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")), asyncResponse) +}</bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:callActivity id="receiveAsyncCallback" name="Receive Async Callback" camunda:modelerTemplate="receiveWorkflowMessage" calledElement="ReceiveWorkflowMessage"> + <bpmn2:extensionElements> + <camunda:in source="true" target="isDebugLogEnabled" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="asyncMessageType" target="RCVWFMSG_messageType" /> + <camunda:in source="asyncCorrelator" target="RCVWFMSG_correlator" /> + <camunda:in source="asyncTimeout" target="RCVWFMSG_timeout" /> + <camunda:out source="WorkflowResponse" target="asyncCallbackResponse" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_0lc15i7</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1fipbmk</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_1fipbmk" sourceRef="receiveAsyncCallback" targetRef="processSniroHomingSolution" /> + <bpmn2:sequenceFlow id="SequenceFlow_01apjvo" sourceRef="processSniroHomingSolution" targetRef="EndEvent_0rrbz2a" /> + <bpmn2:endEvent id="EndEvent_0rrbz2a"> + <bpmn2:incoming>SequenceFlow_01apjvo</bpmn2:incoming> + <bpmn2:terminateEventDefinition /> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_0lc15i7" sourceRef="callSniro" targetRef="receiveAsyncCallback" /> + </bpmn2:process> + <bpmn2:error id="Error_10hit0u" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> + <bpmn2:error id="Error_1lwpypa" name="Java Lang Exception" errorCode="java.lang.Exception" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Homing"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="147" y="275" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0qmfpdr_di" bpmnElement="callSniro"> + <dc:Bounds x="313" y="253" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1x9usa6_di" bpmnElement="SequenceFlow_1x9usa6"> + <di:waypoint x="183" y="293" /> + <di:waypoint x="313" y="293" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="203" y="278" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_16p12qo_di" bpmnElement="bpmnErrorSubprocess" isExpanded="true"> + <dc:Bounds x="254" y="449" width="409" height="168" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_12gjiy8_di" bpmnElement="javaExceptionSubProcess" isExpanded="true"> + <dc:Bounds x="284" y="632" width="350" height="159" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_07tjq3v_di" bpmnElement="EndEvent_07tjq3v"> + <dc:Bounds x="579" y="523" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="552" y="564" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1qiitb2_di" bpmnElement="StartEvent_1qiitb2"> + <dc:Bounds x="299" y="523" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="272" y="564" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_03hs6s9_di" bpmnElement="processMsoWorkflowException"> + <dc:Bounds x="406" y="501" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_19gqykh_di" bpmnElement="processJavaException"> + <dc:Bounds x="410" y="680" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1fbpeuw_di" bpmnElement="StartEvent_1fbpeuw"> + <dc:Bounds x="318" y="702" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="291" y="743" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0jbvnr0_di" bpmnElement="EndEvent_0jbvnr0"> + <dc:Bounds x="567" y="702" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="540" y="743" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1rf4vs8_di" bpmnElement="SequenceFlow_1rf4vs8"> + <di:waypoint x="506" y="541" /> + <di:waypoint x="579" y="541" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="498" y="526" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_00nlh7l_di" bpmnElement="SequenceFlow_00nlh7l"> + <di:waypoint x="335" y="541" /> + <di:waypoint x="363" y="541" /> + <di:waypoint x="363" y="541" /> + <di:waypoint x="406" y="541" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="333" y="541" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0kamg53_di" bpmnElement="SequenceFlow_0kamg53"> + <di:waypoint x="354" y="720" /> + <di:waypoint x="410" y="720" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="337" y="705" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1o7154s_di" bpmnElement="SequenceFlow_1o7154s"> + <di:waypoint x="510" y="720" /> + <di:waypoint x="567" y="720" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="494" y="705" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1aapkvq_di" bpmnElement="processSniroHomingSolution"> + <dc:Bounds x="597" y="253" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_031b5m3_di" bpmnElement="receiveAsyncCallback"> + <dc:Bounds x="455" y="253" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1fipbmk_di" bpmnElement="SequenceFlow_1fipbmk"> + <di:waypoint x="555" y="293" /> + <di:waypoint x="597" y="293" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="531" y="272" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01apjvo_di" bpmnElement="SequenceFlow_01apjvo"> + <di:waypoint x="697" y="293" /> + <di:waypoint x="860" y="293" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="778.5" y="272" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_07i1a5x_di" bpmnElement="EndEvent_0rrbz2a"> + <dc:Bounds x="860" y="275" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="877.17" y="315" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0lc15i7_di" bpmnElement="SequenceFlow_0lc15i7"> + <di:waypoint x="413" y="293" /> + <di:waypoint x="455" y="293" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="434" y="272" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java index e8891eeb53..ac62af2e9d 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java @@ -38,6 +38,7 @@ import org.onap.so.bpmn.common.DelegateExecutionImpl; import org.onap.so.bpmn.infrastructure.aai.tasks.AAICommonTasks; import org.onap.so.bpmn.infrastructure.aai.tasks.AAICreateTasks; import org.onap.so.bpmn.infrastructure.aai.tasks.AAIDeleteTasks; +import org.onap.so.bpmn.infrastructure.aai.tasks.AAIFlagTasks; import org.onap.so.bpmn.infrastructure.aai.tasks.AAIQueryTasks; import org.onap.so.bpmn.infrastructure.aai.tasks.AAIUpdateTasks; import org.onap.so.bpmn.infrastructure.adapter.network.tasks.NetworkAdapterCreateTasks; @@ -46,6 +47,7 @@ import org.onap.so.bpmn.infrastructure.adapter.network.tasks.NetworkAdapterUpdat import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterCreateTasks; import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterDeleteTasks; import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterImpl; +import org.onap.so.bpmn.infrastructure.appc.tasks.AppcRunTasks; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetwork; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignVnf; @@ -61,6 +63,7 @@ import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCChangeAssignTasks; import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCDeactivateTasks; import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCQueryTasks; import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCUnassignTasks; +import org.onap.so.bpmn.infrastructure.workflow.tasks.FlowCompletionTasks; import org.onap.so.bpmn.infrastructure.workflow.tasks.OrchestrationStatusValidator; import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowAction; import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBTasks; @@ -105,6 +108,13 @@ public abstract class BaseBPMNTest { @MockBean protected AAIDeleteTasks aaiDeleteTasks; + + @MockBean + protected AAIFlagTasks aaiFlagTasks; + + + @MockBean + protected AppcRunTasks appcRunTasks; @MockBean protected SDNCActivateTasks sdncActivateTasks; @@ -190,6 +200,9 @@ public abstract class BaseBPMNTest { @MockBean protected ConfigurationScaleOut configurationScaleOut; + @MockBean + protected FlowCompletionTasks flowCompletionTasks; + @LocalServerPort private int port; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecsTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecsTest.java new file mode 100644 index 0000000000..77146593ba --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecsTest.java @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.activity; + +import static org.junit.Assert.*; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.message.BasicHttpResponse; +import org.junit.Test; + +public class DeployActivitySpecsTest { + private static final String RESULT_STRING = "HTTP/1.1 404 "; + private static final String HOSTNAME = "http://localhost:8080"; + + @Test + public void DeployActivitySpecsMain_Test() throws Exception { + ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1); + HttpResponse response = new BasicHttpResponse(protocolVersion, 1, ""); + response.setStatusCode(404); + response.setStatusLine(protocolVersion, 1, ""); + HttpClient clientMock = mock(HttpClient.class); + when(clientMock.execute(any(HttpPost.class))).thenReturn(response); + String[] args = new String[] {HOSTNAME}; + DeployActivitySpecs.main(args); + } + + @Test + public void DeployActivitySpec_Test() throws Exception { + ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1); + HttpResponse response = new BasicHttpResponse(protocolVersion, 1, ""); + response.setStatusCode(404); + response.setStatusLine(protocolVersion, 1, ""); + HttpClient clientMock = mock(HttpClient.class); + when(clientMock.execute(any(HttpPost.class))).thenReturn(response); ; + String result = DeployActivitySpecs.deployActivitySpec(HOSTNAME, "VNFQuiesceTrafficActivitySpec.json"); + assertEquals(result, RESULT_STRING); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java new file mode 100644 index 0000000000..50184a535d --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.BaseBPMNTest; + +public class FlowCompleteActivity extends BaseBPMNTest{ + @Test + public void sunnyDayFlowCompleteActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("FlowCompleteActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("FlowCompleteActivity_Start", + "TaskUpdateRequestDB", + "FlowCompleteActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayFlowCompleteActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(flowCompletionTasks) + .updateRequestDbStatus(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("FlowCompleteActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("FlowCompleteActivity_Start", + "TaskUpdateRequestDB").hasNotPassed( + "FlowCompleteActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java new file mode 100644 index 0000000000..99e7f308f7 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.appc.client.lcm.model.Action; + +public class VNFHealthCheckActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFHealthCheckActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFHealthCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFHealthCheckActivity_Start", + "TaskPreProcessActivity", + "TaskHealthCheck", + "VNFHealthCheckActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFHealthCheckActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFHealthCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFHealthCheckActivity_Start", + "TaskPreProcessActivity", + "TaskHealthCheck").hasNotPassed( + "VNFHealthCheckActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java new file mode 100644 index 0000000000..2305485bfc --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.appc.client.lcm.model.Action; + +public class VNFQuiesceTrafficActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFQuiesceTrafficActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFQuiesceTrafficActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFQuiesceTrafficActivity_Start", + "TaskPreProcessActivity", + "TaskQuiesceTraffic", + "VNFQuiesceTrafficActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFQuiesceTrafficActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFQuiesceTrafficActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFQuiesceTrafficActivity_Start", + "TaskPreProcessActivity", + "TaskQuiesceTraffic").hasNotPassed( + "VNFQuiesceTrafficActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java new file mode 100644 index 0000000000..d3ff31eb9c --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.appc.client.lcm.model.Action; + +public class VNFResumeTrafficActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFResumeTrafficActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFResumeTrafficActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFResumeTrafficActivity_Start", + "TaskPreProcessActivity", + "TaskResumeTraffic", + "VNFResumeTrafficActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFResumeTrafficActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFResumeTrafficActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFResumeTrafficActivity_Start", + "TaskPreProcessActivity", + "TaskResumeTraffic").hasNotPassed( + "VNFResumeTrafficActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetInMaintFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetInMaintFlagActivityTest.java new file mode 100644 index 0000000000..b3b4d82c35 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetInMaintFlagActivityTest.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.BaseBPMNTest; + +public class VNFSetInMaintFlagActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFSetInMaintFlagActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetInMaintFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFSetInMaintFlagActivity_Start", + "TaskSetInMaint", + "VNFSetInMaintFlagActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFSetInMaintFlagActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) + .modifyVnfInMaintFlag(any(BuildingBlockExecution.class), any(boolean.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetInMaintFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFSetInMaintFlagActivity_Start", + "TaskSetInMaint").hasNotPassed( + "VNFSetInMaintFlagActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetInMaintFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetInMaintFlagActivityTest.java new file mode 100644 index 0000000000..1225da5829 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetInMaintFlagActivityTest.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.BaseBPMNTest; + +public class VNFUnsetInMaintFlagActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFUnsetInMaintFlagActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInMaintFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetInMaintFlagActivity_Start", + "TaskUnsetInMaint", + "VNFUnsetInMaintFlagActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFUnsetInMaintFlag_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) + .modifyVnfInMaintFlag(any(BuildingBlockExecution.class), any(boolean.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInMaintFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetInMaintFlagActivity_Start", + "TaskUnsetInMaint").hasNotPassed( + "VNFUnsetInMaintFlagActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java new file mode 100644 index 0000000000..288cf48778 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.appc.client.lcm.model.Action; + +public class VNFUpgradePostCheckActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFUpgradePostCheckActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePostCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradePostCheckActivity_Start", + "TaskPreProcessActivity", + "TaskUpgradePostCheck", + "VNFUpgradePostCheckActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFUpgradePostCheckActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePostCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradePostCheckActivity_Start", + "TaskPreProcessActivity", + "TaskUpgradePostCheck").hasNotPassed( + "VNFUpgradePostCheckActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java new file mode 100644 index 0000000000..2b82197342 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.appc.client.lcm.model.Action; + +public class VNFUpgradePreCheckActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFUpgradePreCheckActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePreCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradePreCheckActivity_Start", + "TaskPreProcessActivity", + "TaskUpgradePreCheck", + "VNFUpgradePreCheckActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFUpgradePreCheckActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePreCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradePreCheckActivity_Start", + "TaskPreProcessActivity", + "TaskUpgradePreCheck").hasNotPassed( + "VNFUpgradePreCheckActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java new file mode 100644 index 0000000000..93d20e9109 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.appc.client.lcm.model.Action; + +public class VNFUpgradeSoftwareActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFUpgradeSoftwareActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeSoftwareActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradeSoftwareActivity_Start", + "TaskPreProcessActivity", + "TaskUpgradeSoftware", + "VNFUpgradeSoftwareActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFUpgradeSoftwareActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeSoftwareActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradeSoftwareActivity_Start", + "TaskPreProcessActivity", + "TaskUpgradeSoftware").hasNotPassed( + "VNFUpgradeSoftwareActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml index ad51b3f69e..3523703ee8 100644 --- a/bpmn/so-bpmn-infrastructure-common/pom.xml +++ b/bpmn/so-bpmn-infrastructure-common/pom.xml @@ -197,11 +197,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - - </dependency> - <dependency> <groupId>com.fasterxml.uuid</groupId> <artifactId>java-uuid-generator</artifactId> </dependency> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy index 545cba7f8c..c48d000ab3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy @@ -32,14 +32,16 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.logger.MsoLogger +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.logger.MsoLogger /** * This groovy class supports the <class>ActivateSDNCCNetworkResource.bpmn</class> process. * flow for SDNC Network Resource Activate */ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateSDNCNetworkResource.class); - + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ActivateSDNCNetworkResource.class); + String Prefix = "ACTSDNCRES_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -48,18 +50,19 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + MsoUtils msoUtils = new MsoUtils() + + public void preProcessRequest(DelegateExecution execution) { - msoLogger.trace("Started preProcessRequest ") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started preProcessRequest *****") try { //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") - msoLogger.info("The requestAction is: " + requestAction) String recipeParamsFromRequest = execution.getVariable("recipeParams") - msoLogger.info("The recipeParams is: " + recipeParamsFromRequest) String resourceInput = execution.getVariable("resourceInput") - msoLogger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) execution.setVariable(Prefix + "resourceInput", resourceInputObj) @@ -78,9 +81,41 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") } - // TODO: based on the resource type decide action and operation type String sdnc_svcAction = "activate" - operationType = "SOTNConnectivity" + switch (resourceInputObj.getResourceModelInfo().getModelName()) { + case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ : + operationType = "SOTNConnectivity" + break + + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + operationType = "SOTNAttachment" + break + + case ~/[\w\s\W]*SiteVF[\w\s\W]*/ : + operationType = "Site" + break + + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + operationType = "SDWANDevice" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + operationType = "SDWANPort" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ : + operationType = "SDWANConnectivity" + break + + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + operationType = "SDWANAttachment" + break + + default: + break + } String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" execution.setVariable(Prefix + "svcAction", sdnc_svcAction) @@ -92,38 +127,39 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + msoLogger.debug( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void prepareUpdateAfterActivateSDNCResource(DelegateExecution execution) { - msoLogger.trace("started prepareUpdateAfterActivateSDNCResource ") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info("started prepareUpdateAfterActivateSDNCResource ") ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() String ServiceInstanceId = resourceInputObj.getServiceInstanceId() String operationId = resourceInputObj.getOperationId() - String progress = "100" - String status = "finished" - String statusDescription = "SDCN resource creation completed" + String progress = "80" + String status = "activated" + String statusDescription = "SDCN resource activation completed" execution.getVariable("operationId") String body = """ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:ns="http://org.onap.so/requestsdb"> + xmlns:ns="http://org.openecomp.mso/requestsdb"> <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <operType>${MsoUtils.xmlEscape(operType)}</operType> - <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> - <progress>${MsoUtils.xmlEscape(progress)}</progress> - <resourceTemplateUUID>${MsoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID> - <serviceId>${MsoUtils.xmlEscape(ServiceInstanceId)}</serviceId> - <status>${MsoUtils.xmlEscape(status)}</status> - <statusDescription>${MsoUtils.xmlEscape(statusDescription)}</statusDescription> + <operType>${msoUtils.xmlEncode(operType)}</operType> + <operationId>${msoUtils.xmlEncode(operationId)}</operationId> + <progress>${msoUtils.xmlEncode(progress)}</progress> + <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID> + <serviceId>${msoUtils.xmlEncode(ServiceInstanceId)}</serviceId> + <status>${msoUtils.xmlEncode(status)}</status> + <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; @@ -131,8 +167,32 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { setProgressUpdateVariables(execution, body) } + private void setProgressUpdateVariables(DelegateExecution execution, String body) { + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + execution.setVariable("CVFMI_updateResOperStatusRequest", body) + } + + String customizeResourceParam(String networkInputParametersJson) { + List<Map<String, Object>> paramList = new ArrayList(); + JSONObject jsonObject = new JSONObject(networkInputParametersJson); + Iterator iterator = jsonObject.keys(); + while (iterator.hasNext()) { + String key = iterator.next(); + HashMap<String, String> hashMap = new HashMap(); + hashMap.put("name", key); + hashMap.put("value", jsonObject.get(key)) + paramList.add(hashMap) + } + Map<String, List<Map<String, Object>>> paramMap = new HashMap(); + paramMap.put("param", paramList); + + return new JSONObject(paramMap).toString(); + } + public void prepareSDNCRequest (DelegateExecution execution) { - msoLogger.trace("Started prepareSDNCRequest ") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info("Started prepareSDNCRequest ") try { // get variables @@ -141,11 +201,13 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") String hdrRequestId = execution.getVariable("mso-request-id") String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") String source = execution.getVariable("source") String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String networkInstanceId = execution.getVariable("networkInstanceId") String serviceType = resourceInputObj.getServiceType() String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid() @@ -165,172 +227,169 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { String sdncTopologyActivateRequest = "" switch (modelName) { - case ~/^Site$/: - sdncTopologyActivateRequest = - """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" - xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteVF[\w\s\W]*/: + sdncTopologyActivateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEncode(globalCustomerId)}</subscriber-name> </service-information> <vnf-information> - <vnf-id></vnf-id> + <vnf-id>${msoUtils.xmlEncode(networkInstanceId)}</vnf-id> <vnf-type></vnf-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> </vnf-information> - <vnf-input-parameters> - <param>${MsoUtils.xmlEscape(netowrkInputParameters)}</param> - </vnf-input-parameters> <vnf-request-input> - <request-version></request-version> - <vnf-name></vnf-name> - <neutron-id></neutron-id> - <contrail-network-fqdn></contrail-network-fqdn> - <subnets-data> - <subnet-data> - <element> - <ip-version></ip-version> - <subnet-id></subnet-id> - </subnet-data> - </subnets-data> - </vnf-request-input> + <vnf-input-parameters> + $netowrkInputParameters + </vnf-input-parameters> + <request-version></request-version> + <vnf-name></vnf-name> + <vnf-networks> + </vnf-networks> + </vnf-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break - case ~/^SOTNAttachment$/: + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/: sdncTopologyActivateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> </service-information> <allotted-resource-information> <!-- TODO: to be filled as per the request input --> - <allotted-resource-input></allotted-resource-input> + <allotted-resource-id>${msoUtils.xmlEncode(networkInstanceId)}</allotted-resource-id> <allotted-resource-type></allotted-resource-type> - <parent-service-instance-id><parent-service-instance-id> + <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> </allotted-resource-information> <connection-attachment-request-input> - <param>${MsoUtils.xmlEscape(netowrkInputParameters)}</param> + $netowrkInputParameters </connection-attachment-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break + // for SDWANConnectivity and SOTN Connectivity default: sdncTopologyActivateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> </service-information> <network-information> <!-- TODO: to be filled by response from create --> - <network-id></network-id> + <network-id>${msoUtils.xmlEncode(networkInstanceId)}</network-id> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> </network-information> <network-request-input> - <network-input-parameters>${MsoUtils.xmlEscape(netowrkInputParameters)}</network-input-parameters> + <network-input-parameters>$netowrkInputParameters</network-input-parameters> </network-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() @@ -338,21 +397,20 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { } String sdncTopologyActivateRequesAsString = utils.formatXml(sdncTopologyActivateRequest) - msoLogger.debug(sdncTopologyActivateRequesAsString) execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyActivateRequesAsString) - msoLogger.debug("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyActivateRequesAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in CreateSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + msoLogger.debug( exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.trace("Exit prepareSDNCRequest ") + msoLogger.info(" ***** Exit prepareSDNCRequest *****") } - public void postCreateSDNCCall(DelegateExecution execution) { - msoLogger.trace("started postCreateSDNCCall ") + public void postActivateSDNCCall(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info("started postCreateSDNCCall ") String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") @@ -361,24 +419,22 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { } public void sendSyncResponse(DelegateExecution execution) { - msoLogger.trace("started sendSyncResponse ") - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) + msoLogger.dubug(" *** sendSyncResponse *** ") try { String operationStatus = "finished" // RESTResponse for main flow String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) + msoLogger.dubug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) sendWorkflowResponse(execution, 202, resourceOperationResp) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) + msoLogger.debug( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + msoLogger.dubug(" ***** Exit sendSyncResopnse *****") } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy index ec8df3daa1..d2903f5396 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 * @@ -20,12 +20,12 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.json.JSONArray import org.json.JSONObject import org.json.XML import static org.apache.commons.lang3.StringUtils.* import groovy.xml.XmlUtil -import groovy.json.* import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.ExternalAPIUtil @@ -39,6 +39,7 @@ import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.Abstr import org.onap.so.rest.APIResponse import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory +import java.util.Map import java.util.UUID import org.onap.so.logger.MsoLogger @@ -62,7 +63,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, Create3rdONAPE2EServiceInstance.class) public void checkSPPartnerInfo (DelegateExecution execution) { @@ -77,19 +78,19 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String resourceInput = execution.getVariable("resourceInput") msoLogger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object - ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) String resourceInputPrameters = resourceInputObj.getResourceParameters() - String inputParametersJson = jsonUtil.getJsonValue(resourceInputPrameters, "requestInputs") - JSONObject inputParameters = new JSONObject(customizeResourceParam(inputParametersJson)) + String inputParametersJson = JsonUtils.getJsonValue(resourceInputPrameters, "requestInputs") + JSONObject inputParameters = new JSONObject(inputParametersJson) // set local resourceInput execution.setVariable(Prefix + "ResourceInput", resourceInputObj) boolean is3rdONAPExist = false - if(inputParameters.has("url")) + if(inputParameters.has("sppartner_url")) { - String sppartnerUrl = inputParameters.get("url") + String sppartnerUrl = inputParameters.get("sppartner_url") if(!isBlank(sppartnerUrl)) { execution.setVariable(Prefix + "SppartnerUrl", sppartnerUrl) is3rdONAPExist = true @@ -100,32 +101,32 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso msoLogger.debug(msg) } } - if(inputParameters.has("providingServiceInvarianteUuid")) + if(inputParameters.has("sppartner_providingServiceUuid")) { - String sppartnerInvarianteUUID = inputParameters.get("providingServiceInvarianteUuid") - execution.setVariable(Prefix + "SppartnerInvarianteUUID", sppartnerInvarianteUUID) + String sppartnerUUID= inputParameters.get("sppartner_providingServiceUuid") + execution.setVariable(Prefix + "SppartnerUUID", sppartnerUUID) is3rdONAPExist = true } else { is3rdONAPExist = false - String msg = "sppartner providingServiceInvarianteUuid is blank." + String msg = "sppartner providingServiceUuid is blank." msoLogger.debug(msg) } - if(inputParameters.has("providingServiceUuid")) + if(inputParameters.has("sppartner_providingServiceInvariantUuid")) { - String sppartnerUUID = inputParameters.get("providingServiceUuid") - execution.setVariable(Prefix + "SppartnerUUID", sppartnerUUID) + String sppartnerInvarianteUUID = inputParameters.get("sppartner_providingServiceInvariantUuid") + execution.setVariable(Prefix + "SppartnerInvarianteUUID", sppartnerInvarianteUUID) is3rdONAPExist = true } else { is3rdONAPExist = false - String msg = "sppartner providingServiceUuid is blank." + String msg = "sppartner providingServiceInvarianteUuid is blank." msoLogger.debug(msg) } - if(inputParameters.has("handoverMode")) + if(inputParameters.has("sppartner_handoverMode")) { - String handoverMode = inputParameters.get("handoverMode") + String handoverMode = inputParameters.get("sppartner_handoverMode") execution.setVariable(Prefix + "HandoverMode", handoverMode) is3rdONAPExist = true } @@ -134,7 +135,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String msg = "sppartner handoverMode is blank." msoLogger.debug(msg) } - + execution.setVariable("Is3rdONAPExist", is3rdONAPExist) execution.setVariable(Prefix + "ServiceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) @@ -150,7 +151,6 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } public void checkLocallCall (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") msoLogger.info(" ***** Started checkLocallCall *****") try { @@ -159,9 +159,9 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso //uuiRequest String incomingRequest = resourceInputObj.getRequestsInputs() - String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters") + String serviceParameters = JsonUtils.getJsonValue(incomingRequest, "service.parameters") String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") - JSONObject inputParameters = new JSONObject(customizeResourceParam(requestInputs)) + JSONObject inputParameters = new JSONObject(requestInputs) execution.setVariable(Prefix + "ServiceParameters", inputParameters) // CallSource is added only when ONAP SO calling 3rdONAP(External API) SO(Remote call) @@ -189,17 +189,16 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } public void preProcessRequest(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") msoLogger.info(" ***** Started preProcessRequest *****") + String msg = "" + try { ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") - String msg = "" String globalSubscriberId = resourceInputObj.getGlobalSubscriberId() if (isBlank(globalSubscriberId)) { msg = "Input globalSubscriberId is null" - msoLogger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + msoLogger.error(msg) } //set local variable execution.setVariable("globalSubscriberId", globalSubscriberId) @@ -208,8 +207,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String serviceType = resourceInputObj.getServiceType() if (isBlank(serviceType)) { msg = "Input serviceType is null" - msoLogger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + msoLogger.error(msg) } execution.setVariable("serviceType", serviceType) msoLogger.info("serviceType:" + serviceType) @@ -217,8 +215,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String resourceName = resourceInputObj.getResourceInstanceName() if (isBlank(resourceName)) { msg = "Input resourceName is null" - msoLogger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + msoLogger.error(msg) } execution.setVariable("resourceName", resourceName) msoLogger.info("resourceName:" + resourceName) @@ -230,23 +227,45 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String serviceInstanceId = resourceInputObj.getServiceInstanceId() if (isBlank(serviceInstanceId)) { msg = "Input serviceInstanceId is null" - msoLogger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + msoLogger.error(msg) } execution.setVariable(Prefix + "ServiceInstanceId", serviceInstanceId) msoLogger.info("serviceInstanceId:" + serviceInstanceId) + String resourceModelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid() + if (isBlank(resourceModelInvariantUuid)) { + msg = "Input resourceModelInvariantUuid is null" + msoLogger.error(msg) + } + execution.setVariable(Prefix + "ResourceModelInvariantUuid", resourceModelInvariantUuid) + msoLogger.info("resourceModelInvariantUuid:" + resourceModelInvariantUuid) + + String resourceModelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() + if (isBlank(resourceModelUuid)) { + msg = "Input resourceModelUuid is null" + msoLogger.error(msg) + } + execution.setVariable(Prefix + "ResourceModelUuid", resourceModelUuid) + msoLogger.info("resourceModelUuid:" + resourceModelUuid) + + String resourceModelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + if (isBlank(resourceModelCustomizationUuid)) { + msg = "Input resourceModelCustomizationUuid is null" + msoLogger.error(msg) + } + execution.setVariable(Prefix + "ResourceModelCustomizationUuid", resourceModelCustomizationUuid) + msoLogger.info("resourceModelCustomizationUuid:" + resourceModelCustomizationUuid) + } catch (BpmnError e) { throw e } catch (Exception ex){ - String msg = "Exception in preProcessRequest " + ex.getMessage() + msg = "Exception in preProcessRequest " + ex.getMessage() msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void prepareUpdateProgress(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") msoLogger.info(" ***** Started prepareUpdateProgress *****") ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") String operType = resourceInputObj.getOperationType() @@ -280,7 +299,6 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } public void allocateCrossONAPResource(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") msoLogger.info(" ***** Started allocateCrossONAPResource *****") //get TP links from AAI for SOTN handoverMode only @@ -288,42 +306,45 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso if("SOTN".equalsIgnoreCase(handoverMode)) { // Put TP Link info into serviceParameters JSONObject inputParameters = execution.getVariable(Prefix + "ServiceParameters") - - Map<String, Object> crossTPs = new HashMap<String, Object>(); - crossTPs.put("local-access-provider-id", inputParameters.get("remote-access-provider-id")); - crossTPs.put("local-access-client-id", inputParameters.get("remote-access-client-id")); - crossTPs.put("local-access-topology-id", inputParameters.get("remote-access-topology-id")); - crossTPs.put("local-access-node-id", inputParameters.get("remote-access-node-id")); - crossTPs.put("local-access-ltp-id", inputParameters.get("remote-access-ltp-id")); - crossTPs.put("remote-access-provider-id", inputParameters.get("local-access-provider-id")); - crossTPs.put("remote-access-client-id", inputParameters.get("local-client-id")); - crossTPs.put("remote-access-topology-id", inputParameters.get("local-topology-id")); - crossTPs.put("remote-access-node-id", inputParameters.get("local-node-id")); - crossTPs.put("remote-access-ltp-id", inputParameters.get("local-ltp-id")); - - inputParameters.put("local-access-provider-id", crossTPs.get("local-access-provider-id")); - inputParameters.put("local-access-client-id", crossTPs.get("local-access-client-id")); - inputParameters.put("local-access-topology-id", crossTPs.get("local-access-topology-id")); - inputParameters.put("local-access-node-id", crossTPs.get("local-access-node-id")); - inputParameters.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id")); - inputParameters.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id")); - inputParameters.put("remote-access-client-id", crossTPs.get("remote-client-id")); - inputParameters.put("remote-access-topology-id", crossTPs.get("remote-topology-id")); - inputParameters.put("remote-access-node-id", crossTPs.get("remote-node-id")); - inputParameters.put("remote-access-ltp-id", crossTPs.get("remote-ltp-id")); - - execution.setVariable(Prefix + "ServiceParameters", inputParameters) + if(inputParameters.has("remote-access-provider-id")) { + Map<String, Object> crossTPs = new HashMap<String, Object>(); + crossTPs.put("local-access-provider-id", inputParameters.get("remote-access-provider-id")); + crossTPs.put("local-access-client-id", inputParameters.get("remote-access-client-id")); + crossTPs.put("local-access-topology-id", inputParameters.get("remote-access-topology-id")); + crossTPs.put("local-access-node-id", inputParameters.get("remote-access-node-id")); + crossTPs.put("local-access-ltp-id", inputParameters.get("remote-access-ltp-id")); + crossTPs.put("remote-access-provider-id", inputParameters.get("local-access-provider-id")); + crossTPs.put("remote-access-client-id", inputParameters.get("local-access-client-id")); + crossTPs.put("remote-access-topology-id", inputParameters.get("local-access-topology-id")); + crossTPs.put("remote-access-node-id", inputParameters.get("local-access-node-id")); + crossTPs.put("remote-access-ltp-id", inputParameters.get("local-access-ltp-id")); + + inputParameters.put("local-access-provider-id", crossTPs.get("local-access-provider-id")); + inputParameters.put("local-access-client-id", crossTPs.get("local-access-client-id")); + inputParameters.put("local-access-topology-id", crossTPs.get("local-access-topology-id")); + inputParameters.put("local-access-node-id", crossTPs.get("local-access-node-id")); + inputParameters.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id")); + inputParameters.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id")); + inputParameters.put("remote-access-client-id", crossTPs.get("remote-access-client-id")); + inputParameters.put("remote-access-topology-id", crossTPs.get("remote-access-topology-id")); + inputParameters.put("remote-access-node-id", crossTPs.get("remote-access-node-id")); + inputParameters.put("remote-access-ltp-id", crossTPs.get("remote-access-ltp-id")); + + execution.setVariable(Prefix + "ServiceParameters", inputParameters) + } + else { + msoLogger.error("No allocated CrossONAPResource found in ServiceParameters") + } } msoLogger.info("Exit " + allocateCrossONAPResource) } public void prepare3rdONAPRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") msoLogger.info(" ***** Started prepare3rdONAPRequest *****") String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") - String extAPIPath = sppartnerUrl + 'serviceOrder' + String extAPIPath = sppartnerUrl + '/serviceOrder' execution.setVariable("ExternalAPIURL", extAPIPath) // ExternalAPI message format @@ -334,14 +355,14 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String requestedCompletionDate = utils.generateCurrentTimeInUtc() String priority = "1" // 0-4 0:highest String subscriberId = execution.getVariable("globalSubscriberId") - String customerRole = "" - String subscriberName = "" + String customerRole = "ONAPcustomer" + String subscriberName = subscriberId String referredType = "Consumer" String orderItemId = "1" String action = "add" //for create String serviceState = "active" String serviceName = execution.getVariable("serviceInstanceName") - String serviceUuId = execution.setVariable(Prefix + "SppartnerUUID") + String serviceUuId = execution.getVariable(Prefix + "SppartnerUUID") Map<String, String> valueMap = new HashMap<>() valueMap.put("externalId", '"' + externalId + '"') @@ -357,29 +378,29 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso valueMap.put("orderItemId", '"' + orderItemId + '"') valueMap.put("action", '"' + action + '"') valueMap.put("serviceState", '"' + serviceState + '"') - valueMap.put("serviceId", '""')//To be confirmed + valueMap.put("serviceId", "null") //null for add valueMap.put("serviceName", '"' + serviceName + '"') valueMap.put("serviceUuId", '"' + serviceUuId + '"') - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() // insert CallSource='ExternalAPI' to uuiRequest Map<String, String> requestInputsMap = new HashMap<>() - requestInputsMap.put("inputName", "CallSource") - requestInputsMap.put("inputValue", "ExternalAPI") + requestInputsMap.put("inputName", '"CallSource"') + requestInputsMap.put("inputValue", '"ExternalAPI"') String _requestInputs_ = externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) - requestInputsMap.clear() + requestInputsMap.clear() String serviceInstanceId = execution.getVariable(Prefix + "ServiceInstanceId") - requestInputsMap.put("inputName", "SppartnerServiceId") - requestInputsMap.put("inputValue", serviceInstanceId) + requestInputsMap.put("inputName", '"SppartnerServiceId"') + requestInputsMap.put("inputValue", '"' + serviceInstanceId + '"') _requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) requestInputsMap.clear() String serviceType = execution.getVariable("serviceType") - requestInputsMap.put("inputName", "serviceType") - requestInputsMap.put("inputValue", serviceType) - _requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) + requestInputsMap.put("inputName", '"serviceType"') + requestInputsMap.put("inputValue", '"' + serviceType + '"') + _requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) // Transfer all uuiRequest incomeParameters to ExternalAPI format JSONObject inputParameters = execution.getVariable(Prefix + "ServiceParameters") @@ -390,7 +411,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso requestInputsMap.put("inputName", '"' + inputName+ '"') requestInputsMap.put("inputValue", '"' + inputValue + '"') _requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) - } + } valueMap.put("_requestInputs_", _requestInputs_) String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap) @@ -399,13 +420,14 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } public void doCreateE2ESIin3rdONAP(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") msoLogger.info(" ***** Started doCreateE2ESIin3rdONAP *****") String extAPIPath = execution.getVariable("ExternalAPIURL") String payload = execution.getVariable(Prefix + "Payload") + msoLogger.debug("doCreateE2ESIin3rdONAP externalAPIURL is: " + extAPIPath) + msoLogger.debug("doCreateE2ESIin3rdONAP payload is: " + payload) - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() APIResponse response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload) @@ -416,18 +438,22 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String extApiResponse = response.getResponseBodyAsString() JSONObject responseObj = new JSONObject(extApiResponse) execution.setVariable(Prefix + "PostServiceOrderResponse", extApiResponse) + + msoLogger.debug("doCreateE2ESIin3rdONAP response body is: " + extApiResponse) + //Process Response if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) //200 OK 201 CREATED 202 ACCEPTED { msoLogger.debug("Post ServiceOrder Received a Good Response") - String serviceOrderId = responseObj.get("ServiceOrderId") + String serviceOrderId = responseObj.get("id") execution.setVariable(Prefix + "SuccessIndicator", true) - execution.setVariable("serviceOrderId", serviceOrderId) + execution.setVariable("ServiceOrderId", serviceOrderId) + msoLogger.info("Post ServiceOrderid is: " + serviceOrderId) } else{ - msoLogger.debug("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API") + msoLogger.error("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) +// exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API") } msoLogger.info("Exit " + doCreateE2ESIin3rdONAP) @@ -435,13 +461,13 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso public void getE2ESIProgressin3rdONAP(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") msoLogger.info(" ***** Started getE2ESIProgressin3rdONAP *****") String extAPIPath = execution.getVariable("ExternalAPIURL") extAPIPath += "/" + execution.getVariable("ServiceOrderId") + utils.log("DEBUG", "getE2ESIProgressin3rdONAP create externalAPIURL is: " + extAPIPath, isDebugEnabled) - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) @@ -453,48 +479,72 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso JSONObject responseObj = new JSONObject(extApiResponse) execution.setVariable(Prefix + "GetServiceOrderResponse", extApiResponse) + msoLogger.debug("getE2ESIProgressin3rdONAP create response body is: " + extApiResponse) + //Process Response //200 OK 201 CREATED 202 ACCEPTED - if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) { - msoLogger.debug("Get ServiceOrder Received a Good Response") - - String sppartnerServiceId = responseObj.get("orderIterm.service.id") + msoLogger.debug("Get Create ServiceOrder Received a Good Response") + + String orderState = responseObj.get("state") + if("REJECTED".equalsIgnoreCase(orderState)) { + execution.setVariable("progress", 100) + execution.setVariable("status", "error") + execution.setVariable("statusDescription", "Create Service Order Status is REJECTED") + return + } + + JSONArray items = responseObj.getJSONArray("orderItem") + JSONObject item = items[0] + JSONObject service = item.get("service") + String sppartnerServiceId = service.get("id") + if(sppartnerServiceId == null || sppartnerServiceId.equals("null")) { + execution.setVariable("progress", 100) + execution.setVariable("status", "error") + execution.setVariable("statusDescription", "Create Service Order Status get null sppartnerServiceId") + msoLogger.error("null sppartnerServiceId while getting progress from externalAPI") + return + } + execution.setVariable(Prefix + "SppartnerServiceId", sppartnerServiceId) - String serviceOrderState = responseObj.get("orderIterm.state") + String serviceOrderState = item.get("state") execution.setVariable(Prefix + "SuccessIndicator", true) - execution.setVariable("serviceOrderState", serviceOrderState) + execution.setVariable("ServiceOrderState", serviceOrderState) // Get serviceOrder State and process progress if("ACKNOWLEDGED".equalsIgnoreCase(serviceOrderState)) { execution.setVariable("progress", 15) - execution.setVariable("status", "processing") + execution.setVariable("status", "processing") + execution.setVariable("statusDescription", "Create Service Order Status is " + serviceOrderState) } - if("INPROGRESS".equalsIgnoreCase(serviceOrderState)) { + else if("INPROGRESS".equalsIgnoreCase(serviceOrderState)) { execution.setVariable("progress", 40) execution.setVariable("status", "processing") + execution.setVariable("statusDescription", "Create Service Order Status is " + serviceOrderState) } - if("COMPLETED".equalsIgnoreCase(serviceOrderState)) { + else if("COMPLETED".equalsIgnoreCase(serviceOrderState)) { execution.setVariable("progress", 100) execution.setVariable("status", "finished") + execution.setVariable("statusDescription", "Create Service Order Status is " + serviceOrderState) } - if("FAILED".equalsIgnoreCase(serviceOrderState)) { + else if("FAILED".equalsIgnoreCase(serviceOrderState)) { execution.setVariable("progress", 100) execution.setVariable("status", "error") + execution.setVariable("statusDescription", "Create Service Order Status is " + serviceOrderState) } else { execution.setVariable("progress", 100) execution.setVariable("status", "error") execution.setVariable("statusDescription", "Create Service Order Status is unknown") } - execution.setVariable("statusDescription", "Create Service Order Status is " + serviceOrderState) } else{ msoLogger.debug("Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) execution.setVariable("progress", 100) execution.setVariable("status", "error") - execution.setVariable("statusDescription", "Get ServiceOrder Received a bad response") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get ServiceOrder Received a bad response from 3rdONAP External API") + execution.setVariable("statusDescription", "Get Create ServiceOrder Received a bad response") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Create ServiceOrder Received a bad response from 3rdONAP External API") } msoLogger.info("Exit " + getE2ESIProgressin3rdONAP) @@ -504,17 +554,15 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso * delay 5 sec */ public void timeDelay(DelegateExecution execution) { - def isDebugEnabled= execution.getVariable("isDebugLogEnabled") try { Thread.sleep(5000) } catch(InterruptedException e) { - utils.log("ERROR", "Time Delay exception" + e ) + msoLogger.error("Time Delay exception" + e) } } public void saveSPPartnerInAAI(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - msoLogger.info(" ***** Started postCreateE2ESIin3rdONAP *****") + msoLogger.info(" ***** Started saveSPPartnerInAAI *****") String sppartnerId = execution.getVariable(Prefix + "SppartnerServiceId") String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") @@ -522,8 +570,11 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String serviceInstanceId = execution.getVariable(Prefix + "ServiceInstanceId") String globalSubscriberId = execution.getVariable("globalSubscriberId") String serviceType = execution.getVariable("serviceType") + String resourceModelInvariantUuid = execution.getVariable(Prefix + "ResourceModelInvariantUuid") + String resourceModelUuid = execution.getVariable(Prefix + "ResourceModelUuid") + String resourceModelCustomizationUuid = execution.getVariable(Prefix + "ResourceModelCustomizationUuid") - AaiUtil aaiUriUtil = new AaiUtil(this) + AaiUtil aaiUriUtil = new AaiUtil() String aai_uri = aaiUriUtil.getBusinessSPPartnerUri(execution) String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) @@ -532,6 +583,9 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso <id>${sppartnerId}</id> <url>${sppartnerUrl}</url> <callsource>${callSource}</callsource> + <model-invariant-id>${resourceModelInvariantUuid}</model-invariant-id> + <model-version-id>${resourceModelUuid}</model-version-id> + <model-customization-id>${resourceModelCustomizationUuid}</model-customization-id> <relationship-list> <relationship> <related-to>service-instance</related-to> @@ -551,7 +605,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload) int responseCode = response.getStatusCode() execution.setVariable(Prefix + "PutSppartnerResponseCode", responseCode) - msoLogger.debug(" Put sppartner response code is: " + responseCode) + msoLogger.debug("Put sppartner response code is: " + responseCode) String aaiResponse = response.getResponseBodyAsString() aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) @@ -581,7 +635,6 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } public void postProcess(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") msoLogger.info(" ***** Started postProcess *****") String responseCode = execution.getVariable(Prefix + "PutSppartnerResponseCode") String responseObj = execution.getVariable(Prefix + "PutSppartnerResponse") @@ -591,7 +644,6 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") msoLogger.debug(" *** sendSyncResponse *** ") try { @@ -609,21 +661,4 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } msoLogger.debug(" ***** Exit sendSyncResopnse *****") } - - String customizeResourceParam(String inputParametersJson) { - List<Map<String, Object>> paramList = new ArrayList() - JSONObject jsonObject = new JSONObject(inputParametersJson) - Iterator iterator = jsonObject.keys() - while (iterator.hasNext()) { - String key = iterator.next() - HashMap<String, String> hashMap = new HashMap() - hashMap.put("name", key) - hashMap.put("value", jsonObject.get(key)) - paramList.add(hashMap) - } - Map<String, List<Map<String, Object>>> paramMap = new HashMap() - paramMap.put("param", paramList) - - return new JSONObject(paramMap).toString() - } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy index 15b63fb5ab..89a6239be7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy @@ -65,6 +65,7 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { public void preProcessRequest(DelegateExecution execution){ msoLogger.info(" ***** Started preProcessRequest *****") + String msg = "" try { //get bpmn inputs from resource request. @@ -77,25 +78,52 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { msoLogger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) - execution.setVariable(Prefix + "resourceInput", resourceInputObj) - String resourceInputPrameters = resourceInputObj.getResourceParameters() - String inputParametersJson = jsonUtil.getJsonValue(resourceInputPrameters, "requestInputs") - JSONObject inputParameters = new JSONObject(customizeResourceParam(inputParametersJson)) - execution.setVariable(Prefix + "resourceRequestInputs", inputParameters) + execution.setVariable(Prefix + "ResourceInput", resourceInputObj) + + String resourceInputPrameters = resourceInputObj.getResourceParameters() + String inputParametersJson = jsonUtil.getJsonValue(resourceInputPrameters, "requestInputs") + JSONObject inputParameters = new JSONObject(inputParametersJson) + execution.setVariable(Prefix + "ResourceRequestInputs", inputParameters) + +// String incomingRequest = resourceInputObj.getRequestsInputs() +// String serviceParameters = JsonUtils.getJsonValue(incomingRequest, "service.parameters") +// String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") +// JSONObject serviceInputParameters = new JSONObject(requestInputs) +// execution.setVariable(Prefix + "ServiceParameters", serviceInputParameters) //Deal with recipeParams String recipeParamsFromWf = execution.getVariable("recipeParamXsd") - String resourceName = resourceInputObj.getResourceInstanceName() - //For sdnc requestAction default is "createNetworkInstance" - String operationType = "Network" - if(!StringUtils.isBlank(recipeParamsFromRequest)){ - //the operationType from worflow(first node) is second priority. - operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") + String resourceName = resourceInputObj.getResourceInstanceName() + if (isBlank(resourceName)) { + msg = "Input resourceName is null" + msoLogger.error(msg) } - if(!StringUtils.isBlank(recipeParamsFromWf)){ - //the operationType from worflow(first node) is highest priority. - operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") + execution.setVariable("resourceName", resourceName) + msoLogger.info("resourceName:" + resourceName) + + String resourceModelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid() + if (isBlank(resourceModelInvariantUuid)) { + msg = "Input resourceModelInvariantUuid is null" + msoLogger.error(msg) + } + execution.setVariable(Prefix + "ResourceModelInvariantUuid", resourceModelInvariantUuid) + msoLogger.info("resourceModelInvariantUuid:" + resourceModelInvariantUuid) + + String resourceModelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() + if (isBlank(resourceModelUuid)) { + msg = "Input resourceModelUuid is null" + msoLogger.error(msg) + } + execution.setVariable(Prefix + "ResourceModelUuid", resourceModelUuid) + msoLogger.info("resourceModelUuid:" + resourceModelUuid) + + String resourceModelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + if (isBlank(resourceModelCustomizationUuid)) { + msg = "Input resourceModelCustomizationUuid is null" + msoLogger.error(msg) } + execution.setVariable(Prefix + "ResourceModelCustomizationUuid", resourceModelCustomizationUuid) + msoLogger.info("resourceModelCustomizationUuid:" + resourceModelCustomizationUuid) execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) @@ -103,40 +131,26 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception ex){ - String msg = "Exception in preProcessRequest " + ex.getMessage() + msg = "Exception in preProcessRequest " + ex.getMessage() msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } - String customizeResourceParam(String networkInputParametersJson) { - List<Map<String, Object>> paramList = new ArrayList(); - JSONObject jsonObject = new JSONObject(networkInputParametersJson); - Iterator iterator = jsonObject.keys(); - while (iterator.hasNext()) { - String key = iterator.next(); - HashMap<String, String> hashMap = new HashMap(); - hashMap.put("name", key); - hashMap.put("value", jsonObject.get(key)) - paramList.add(hashMap) - } - Map<String, List<Map<String, Object>>> paramMap = new HashMap(); - paramMap.put("param", paramList); - - return new JSONObject(paramMap).toString(); - } - public void checkDevType(DelegateExecution execution){ msoLogger.info(" ***** Started checkDevType *****") try { - - JSONObject inputParameters = execution.getVariable(Prefix + "resourceRequestInputs") - String devType = inputParameters.get("device_class") + JSONObject resourceInputParameters = execution.getVariable(Prefix + "ResourceRequestInputs") + String devType = resourceInputParameters.get("device_class") if(StringUtils.isBlank(devType)) { devType = "OTHER" } + // support VNF as PNF, to modify + else if(StringUtils.equalsIgnoreCase(devType, "VNF")) { + devType = "PNF" + } execution.setVariable("device_class", devType) @@ -147,6 +161,45 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { } } + private void setProgressUpdateVariables(DelegateExecution execution, String body) { + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + execution.setVariable("CVFMI_updateResOperStatusRequest", body) + } + + public void prepareUpdateProgress(DelegateExecution execution) { + msoLogger.info(" ***** Started prepareUpdateProgress *****") + ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") + String operType = resourceInputObj.getOperationType() + String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String ServiceInstanceId = resourceInputObj.getServiceInstanceId() + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + String operationId = resourceInputObj.getOperationId() + String progress = execution.getVariable("progress") + String status = execution.getVariable("status") + String statusDescription = execution.getVariable("statusDescription") + + String body = """ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.openecomp.mso/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:updateResourceOperationStatus> + <operType>${operType}</operType> + <operationId>${operationId}</operationId> + <progress>${progress}</progress> + <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID> + <serviceId>${ServiceInstanceId}</serviceId> + <status>${status}</status> + <statusDescription>${statusDescription}</statusDescription> + </ns:updateResourceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + setProgressUpdateVariables(execution, body) + msoLogger.info(" ***** Exit prepareUpdateProgress *****") + } + public void getVNFTemplatefromSDC(DelegateExecution execution){ msoLogger.info(" ***** Started getVNFTemplatefromSDC *****") try { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy index 4405718c57..968612301d 100644..100755 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy @@ -18,7 +18,10 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.infrastructure.scripts; +package org.onap.so.bpmn.infrastructure.scripts + +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.VnfResource; import static org.apache.commons.lang3.StringUtils.*; @@ -43,315 +46,358 @@ import groovy.json.* * */ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskProcessor { - String Prefix="CRESI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateGenericALaCarteServiceInstance.class); - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - String msg = "" - - try { - - String siRequest = execution.getVariable("bpmnRequest") - msoLogger.debug(siRequest) - - String requestId = execution.getVariable("mso-request-id") - execution.setVariable("msoRequestId", requestId) - msoLogger.debug("Input Request:" + siRequest + " reqId:" + requestId) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - if (isBlank(serviceInstanceId)) { - serviceInstanceId = UUID.randomUUID().toString() - msoLogger.debug("Generated new Service Instance ID:" + serviceInstanceId) - } else { - msoLogger.debug("Using provided Service Instance ID:" + 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 = null; - try { - productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") - } catch (JSONException e) { - productFamilyId = null; - } - if (isBlank(productFamilyId)) - { - msg = "Input productFamilyId is null" - msoLogger.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" - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else - { - execution.setVariable("serviceModelInfo", serviceModelInfo) - } - - msoLogger.debug("modelInfo" + serviceModelInfo) - - //requestParameters - String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") - if (isBlank(subscriptionServiceType)) { - msg = "Input subscriptionServiceType is null" - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("subscriptionServiceType", subscriptionServiceType) - } - - - /* - * Extracting User Parameters from incoming Request and converting into a Map - */ - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - - Map reqMap = jsonSlurper.parseText(siRequest) - - //InputParams - def userParams = reqMap.requestDetails?.requestParameters?.userParams - - Map<String, String> inputMap = [:] - if (userParams) { - userParams.each { - userParam -> inputMap.put(userParam.name, userParam.value.toString()) - } - } - - msoLogger.debug("User Input Parameters map: " + userParams.toString()) - execution.setVariable("serviceInputParams", inputMap) - - //TODO - //execution.setVariable("failExists", true) - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - msoLogger.trace("Exit preProcessRequest") - } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("Start sendSyncResponse") - - try { - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - // RESTResponse for API Handler (APIH) Reply Task - String createServiceRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() - msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + createServiceRestRequest) - sendWorkflowResponse(execution, 202, createServiceRestRequest) - execution.setVariable("sentSyncResponse", true) - - } catch (Exception ex) { - String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - msoLogger.trace("Exit sendSyncResopnse") - } - - - public void sendSyncError (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("Start sendSyncError") - - try { - String errorMessage = "" - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - errorMessage = wfe.getErrorMessage() - } else { - errorMessage = "Sending Sync Error." - } - - String buildworkflowException = - """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> - <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage> - <aetgt:ErrorCode>7000</aetgt:ErrorCode> - </aetgt:WorkflowException>""" - - msoLogger.debug(buildworkflowException) - sendWorkflowResponse(execution, 500, buildworkflowException) - - } catch (Exception ex) { - msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) - } - - } - - // ******************************* - // - // ******************************* - public void prepareDecomposeService(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("Inside prepareDecomposeService of CreateGenericALaCarteServiceInstance ") - try { - String siRequest = execution.getVariable("bpmnRequest") - String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") - execution.setVariable("serviceModelInfo", serviceModelInfo) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - msoLogger.trace("Completed prepareDecomposeService of CreateGenericALaCarteServiceInstance") - } - - - // ******************************* - // - // ******************************* - public void prepareCreateServiceInstance(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + String Prefix="CRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateGenericALaCarteServiceInstance.class); + + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + String msg = "" + + try { + + String siRequest = execution.getVariable("bpmnRequest") + msoLogger.debug(siRequest) + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + msoLogger.debug("Input Request:" + siRequest + " reqId:" + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + serviceInstanceId = UUID.randomUUID().toString() + msoLogger.debug("Generated new Service Instance ID:" + serviceInstanceId) + } else { + msoLogger.debug("Using provided Service Instance ID:" + 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 = null; + try { + productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") + } catch (JSONException e) { + productFamilyId = null; + } + if (isBlank(productFamilyId)) + { + msg = "Input productFamilyId is null" + msoLogger.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" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else + { + execution.setVariable("serviceModelInfo", serviceModelInfo) + } + + msoLogger.debug("modelInfo" + serviceModelInfo) + + //requestParameters + String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + } + + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + + Map reqMap = jsonSlurper.parseText(siRequest) + + //InputParams + def userParams = reqMap.requestDetails?.requestParameters?.userParams + + Map<String, String> inputMap = [:] + if (userParams) { + userParams.each { + userParam -> inputMap.put(userParam.name, userParam.value.toString()) + } + } + + msoLogger.debug("User Input Parameters map: " + userParams.toString()) + execution.setVariable("serviceInputParams", inputMap) + + //TODO + //execution.setVariable("failExists", true) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest") + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("Start sendSyncResponse") + + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + // RESTResponse for API Handler (APIH) Reply Task + String createServiceRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() + msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + createServiceRestRequest) + sendWorkflowResponse(execution, 202, createServiceRestRequest) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit sendSyncResopnse") + } + + + public void sendSyncError (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("Start sendSyncError") + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> + <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException>""" + + msoLogger.debug(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + + } + + // ******************************* + // + // ******************************* + public void prepareDecomposeService(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("Inside prepareDecomposeService of CreateGenericALaCarteServiceInstance ") + try { + String siRequest = execution.getVariable("bpmnRequest") + String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") + execution.setVariable("serviceModelInfo", serviceModelInfo) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + msoLogger.trace("Completed prepareDecomposeService of CreateGenericALaCarteServiceInstance") + } + + public void processDecomposition(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + msoLogger.trace("Inside processDecomposition() of CreateGenericALaCarteServiceInstance ") + + try { + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + // VNFs + List<VnfResource> vnfList = serviceDecomposition.getVnfResources() + filterVnfs(vnfList) + serviceDecomposition.setVnfResources(vnfList) + + execution.setVariable("vnfList", vnfList) + execution.setVariable("vnfListString", vnfList.toString()) + + String vnfModelInfoString = "" + if (vnfList != null && vnfList.size() > 0) { + execution.setVariable(Prefix + "VNFsCount", vnfList.size()) + msoLogger.debug("vnfs to create: " + vnfList.size()) + ModelInfo vnfModelInfo = vnfList[0].getModelInfo() + + vnfModelInfoString = vnfModelInfo.toString() + String vnfModelInfoWithRoot = vnfModelInfo.toString() + vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo") + } else { + execution.setVariable(Prefix + "VNFsCount", 0) + msoLogger.debug("no vnfs to create based upon serviceDecomposition content") + } + + execution.setVariable("vnfModelInfo", vnfModelInfoString) + execution.setVariable("vnfModelInfoString", vnfModelInfoString) + msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString) + + msoLogger.trace("Completed processDecomposition() of CreateGenericALaCarteServiceInstance ") + } catch (Exception ex) { + sendSyncError(execution) + String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. processDecomposition() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // + // ******************************* + public void prepareCreateServiceInstance(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - try { - msoLogger.trace("Inside prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance") + try { + msoLogger.trace("Inside prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance") - /* - * Extracting User Parameters from incoming Request and converting into a Map - */ - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - def siRequest = execution.getVariable("bpmnRequest") - Map reqMap = jsonSlurper.parseText(siRequest) - //InputParams - def userParams = reqMap.requestDetails?.requestParameters?.userParams - Map<String, String> inputMap = [:] - if (userParams != null) { - userParams.each { - userParam -> inputMap.put(userParam.name, userParam.value) - } - } - - msoLogger.debug("User Input Parameters map: " + userParams.toString()) - execution.setVariable("serviceInputParams", inputMap) - - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - serviceDecomposition.getServiceInstance().setInstanceId(serviceInstanceId) - - String serviceInstanceName = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName") - serviceDecomposition.getServiceInstance().setInstanceName(serviceInstanceName) - execution.setVariable("serviceInstanceName", serviceInstanceName) - execution.setVariable("serviceDecomposition", serviceDecomposition) - execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonString()) - msoLogger.debug("serviceDecomposition.serviceInstanceName: " + serviceDecomposition.getServiceInstance().getInstanceName()) - - msoLogger.trace("Completed prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance ***** ") - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - - public void prepareCompletionRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("prepareCompletion *** ") - - 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) - msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) - - } catch (Exception ex) { - String msg = " Exception in prepareCompletion:" + ex.getMessage() - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - msoLogger.trace("Exit prepareCompletionRequest") - } - - public void prepareFalloutRequest(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("prepareFalloutRequest") - - try { - WorkflowException wfex = execution.getVariable("WorkflowException") - msoLogger.debug(" Input Workflow Exception: " + wfex.toString()) - String requestId = execution.getVariable("msoRequestId") - String source = execution.getVariable("source") - String requestInfo = - """<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>""" - - String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) - execution.setVariable("falloutRequest", falloutRequest) - } catch (Exception ex) { - msoLogger.debug("Exception prepareFalloutRequest:" + ex.getMessage()) - String errorException = " Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() - String requestId = execution.getVariable("msoRequestId") - String falloutRequest = - """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" - xmlns:ns="http://org.onap/so/request/types/v1" - xmlns:wfsch="http://org.onap/so/workflow/schema/v1"> - <request-info xmlns="http://org.onap/so/infra/vnf-request/v1"> - <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> - <action>CREATE</action> - <source>VID</source> - </request-info> - <aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> - <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorException)}</aetgt:ErrorMessage> - <aetgt:ErrorCode>7000</aetgt:ErrorCode> - </aetgt:WorkflowException> - </aetgt:FalloutHandlerRequest>""" - - execution.setVariable("falloutRequest", falloutRequest) - } - msoLogger.trace("Exit prepareFalloutRequest") - } + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + def siRequest = execution.getVariable("bpmnRequest") + Map reqMap = jsonSlurper.parseText(siRequest) + //InputParams + def userParams = reqMap.requestDetails?.requestParameters?.userParams + Map<String, String> inputMap = [:] + if (userParams != null) { + userParams.each { + userParam -> inputMap.put(userParam.name, userParam.value) + } + } + + msoLogger.debug("User Input Parameters map: " + userParams.toString()) + execution.setVariable("serviceInputParams", inputMap) + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + serviceDecomposition.getServiceInstance().setInstanceId(serviceInstanceId) + + String serviceInstanceName = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName") + serviceDecomposition.getServiceInstance().setInstanceName(serviceInstanceName) + execution.setVariable("serviceInstanceName", serviceInstanceName) + execution.setVariable("serviceDecomposition", serviceDecomposition) + execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonString()) + msoLogger.debug("serviceDecomposition.serviceInstanceName: " + serviceDecomposition.getServiceInstance().getInstanceName()) + + msoLogger.trace("Completed prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance ***** ") + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + + public void prepareCompletionRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("prepareCompletion *** ") + + 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) + msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit prepareCompletionRequest") + } + + public void prepareFalloutRequest(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("prepareFalloutRequest") + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + msoLogger.debug(" Input Workflow Exception: " + wfex.toString()) + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String requestInfo = + """<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>""" + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + execution.setVariable("falloutRequest", falloutRequest) + } catch (Exception ex) { + msoLogger.debug("Exception prepareFalloutRequest:" + ex.getMessage()) + String errorException = " Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() + String requestId = execution.getVariable("msoRequestId") + String falloutRequest = + """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:ns="http://org.onap/so/request/types/v1" + xmlns:wfsch="http://org.onap/so/workflow/schema/v1"> + <request-info xmlns="http://org.onap/so/infra/vnf-request/v1"> + <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> + <action>CREATE</action> + <source>VID</source> + </request-info> + <aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> + <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorException)}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException> + </aetgt:FalloutHandlerRequest>""" + + execution.setVariable("falloutRequest", falloutRequest) + } + msoLogger.trace("Exit prepareFalloutRequest") + } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index c819da4be4..5255b37bb0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -20,40 +20,54 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.json.JSONObject +import org.json.XML +import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiResponse; + import static org.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.recipe.ResourceInput; +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder +import org.onap.so.rest.APIResponse +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.AaiUtil -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject -import org.json.XML; -import org.onap.so.bpmn.common.recipe.ResourceInput; -import org.onap.so.bpmn.common.resource.ResourceRequestBuilder -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.apache.commons.lang3.* import org.onap.so.bpmn.common.scripts.MsoUtils -import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MsoLogger -import groovy.json.* - /** * This groovy class supports the <class>CreateSDNCCNetworkResource.bpmn</class> process. * flow for SDNC Network Resource Create */ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateSDNCNetworkResource.class); + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateSDNCNetworkResource.class); String Prefix="CRESDNCRES_" - + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - + + MsoUtils msoUtils = new MsoUtils() + public void preProcessRequest(DelegateExecution execution){ - msoLogger.trace("Started preProcessRequest ") - try { - + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started preProcessRequest *****") + try { + //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") @@ -65,12 +79,12 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) execution.setVariable(Prefix + "resourceInput", resourceInputObj) - + //Deal with recipeParams String recipeParamsFromWf = execution.getVariable("recipeParamXsd") - String resourceName = resourceInputObj.getResourceInstanceName() + String resourceName = resourceInputObj.getResourceInstanceName() //For sdnc requestAction default is "createNetworkInstance" - String operationType = "Network" + String operationType = "Network" if(!StringUtils.isBlank(recipeParamsFromRequest)){ //the operationType from worflow(first node) is second priority. operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") @@ -79,27 +93,70 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { //the operationType from worflow(first node) is highest priority. operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") } - - + + //For sdnc, generate svc_action and request_action String sdnc_svcAction = "create" - if(StringUtils.containsIgnoreCase(resourceInputObj.getResourceInstanceName(), "overlay")){ - //This will be resolved in R3. - sdnc_svcAction ="activate" - operationType = "NCINetwork" + switch (resourceInputObj.getResourceInstanceName()) { + + case ~/[\w\s\W]*overlay[\w\s\W]*/ : + //This will be resolved in R3. + sdnc_svcAction ="activate" + operationType = "NCINetwork" + break + + case ~/[\w\s\W]*underlay[\w\s\W]*/ : + //This will be resolved in R3. + operationType ="Network" + break + + case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ : + operationType = "SOTNConnectivity" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + operationType = "SOTNAttachment" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SiteVF[\w\s\W]*/ : + operationType = "Site" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + operationType = "SDWANDevice" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + operationType = "SDWANPort" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ : + operationType = "SDWANConnectivity" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + operationType = "SDWANAttachment" + execution.setVariable("isActivateRequired", "true") + break + + default: + break } - if(StringUtils.containsIgnoreCase(resourceInputObj.getResourceInstanceName(), "underlay")){ - //This will be resolved in R3. - operationType ="Network" - } - String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" - execution.setVariable(Prefix + "svcAction", sdnc_svcAction) + + String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" + execution.setVariable(Prefix + "svcAction", sdnc_svcAction) execution.setVariable(Prefix + "requestAction", sdnc_requestAction) execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) //TODO Here build networkrequest - + } catch (BpmnError e) { throw e; } catch (Exception ex){ @@ -108,7 +165,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } - + String customizeResourceParam(String networkInputParametersJson) { List<Map<String, Object>> paramList = new ArrayList(); JSONObject jsonObject = new JSONObject(networkInputParametersJson); @@ -125,7 +182,65 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { return new JSONObject(paramMap).toString(); } - + + /** + * This method updates the resource input by collecting required info from AAI + * @param execution + */ + public void updateResourceInput(DelegateExecution execution) { + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + + switch (modelName) { + case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/: + + def resourceInput = resourceInputObj.getResourceParameters() + String incomingRequest = resourceInputObj.getRequestsInputs() + String serviceParameters = JsonUtils.getJsonValue(incomingRequest, "service.parameters") + String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") + JSONObject inputParameters = new JSONObject(requestInputs) + if(inputParameters.has("local-access-provider-id")) { + String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.access-provider-id", inputParameters.get("local-access-provider-id")) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.access-client-id", inputParameters.get("local-access-client-id")) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.access-topology-id", inputParameters.get("local-access-topology-id")) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.access-ltp-id", inputParameters.get("local-access-ltp-id")) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.access-node-id", inputParameters.get("local-access-node-id")) + resourceInputObj.setResourceParameters(uResourceInput) + execution.setVariable(Prefix + "resourceInput", resourceInputObj) + } + + break + + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + // fill attachment TP in networkInputParamJson + String customer = resourceInputObj.getGlobalSubscriberId() + String serviceType = resourceInputObj.getServiceType() + + def vpnName = StringUtils.containsIgnoreCase(modelName, "sotnvpnattachment") ? "sotnvpnattachmentvf_sotncondition_sotnVpnName" : "sdwanvpnattachmentvf_sdwancondition_sdwanVpnName" + String parentServiceName = jsonUtil.getJsonValueForKey(resourceInputObj.getRequestsInputs(), vpnName) + + AaiUtil aaiUtil = new AaiUtil(this) + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String customerUri = aaiUtil.getBusinessCustomerUri(execution) + "/" + customer + String aai_service_query_url = aai_endpoint + customerUri + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances?service-instance-name=" + parentServiceName + + APIResponse aaiResponse = aaiUtil.executeAAIGetCall(execution, aai_service_query_url) + def parentServiceInstanceId = getParentServiceInstnaceId(aaiResponse) + execution.setVariable("parentServiceInstanceId", parentServiceInstanceId) + break + + default: + break + } + } + + private String getParentServiceInstnaceId(APIResponse aaiResponse) { + String response = aaiResponse.getResponseBodyAsString() + def xmlResp = new XmlParser().parseText(response) + return "${xmlResp?."service-instance"[0]?."service-instance-id"[0]?.text()}" + } + /** * Pre Process the BPMN Flow Request * Inclouds: @@ -133,15 +248,17 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { * generate the nsParameters */ public void prepareSDNCRequest (DelegateExecution execution) { - msoLogger.trace("Started prepareSDNCRequest ") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started prepareSDNCRequest *****") try { // get variables - String sdnc_svcAction = execution.getVariable(Prefix + "svcAction") + String sdnc_svcAction = execution.getVariable(Prefix + "svcAction") String sdnc_requestAction = execution.getVariable(Prefix + "requestAction") String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") String hdrRequestId = execution.getVariable("mso-request-id") String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") String source = execution.getVariable("source") @@ -166,176 +283,173 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String sdncTopologyCreateRequest = "" switch (modelName) { - case ~/^Site$/: + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteVF[\w\s\W]*/: sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEncode(globalCustomerId)}</subscriber-name> </service-information> - <subscriber-name>${MsoUtils.xmlEscape(globalCustomerId)}</subscriber-name> <vnf-information> - <!-- TODO: to be filled as per the request input --> <vnf-id></vnf-id> <vnf-type></vnf-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> - </network-information> - <vnf-input-parameters> - <network-input-parameters>${MsoUtils.xmlEscape(netowrkInputParameters)}</network-input-parameters> - </vnf-input-parameters> + </vnf-information> <vnf-request-input> - <request-version></request-version> - <vnf-name></vnf-name> - <neutron-id></neutron-id> - <contrail-network-fqdn></contrail-network-fqdn> - <subnets-data> - <subnet-data> - <element> - <ip-version></ip-version> - <subnet-id></subnet-id> - </subnet-data> - </subnets-data> - </vnf-request-input> + <vnf-input-parameters> + $netowrkInputParameters + </vnf-input-parameters> + <request-version></request-version> + <vnf-name></vnf-name> + <vnf-networks> + </vnf-networks> + </vnf-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break - case ~/^SOTNAttachment$/: + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEncode(globalCustomerId)}</subscriber-name> </service-information> - <subscriber-name>${MsoUtils.xmlEscape(globalCustomerId)}</subscriber-name> <allotted-resource-information> <!-- TODO: to be filled as per the request input --> + <allotted-resource-id></allotted-resource-id> <allotted-resource-type></allotted-resource-type> - <parent-service-instance-id><parent-service-instance-id> + <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> </allotted-resource-information> <connection-attachment-request-input> - <param>${MsoUtils.xmlEscape(netowrkInputParameters)}</param> + $netowrkInputParameters </connection-attachment-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break + // for SDWANConnectivity and SOTNConnectivity: default: sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${hdrRequestId}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> </service-information> <network-information> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> </network-information> <network-request-input> - <network-input-parameters>${MsoUtils.xmlEscape(netowrkInputParameters)}</network-input-parameters> + <network-input-parameters>$netowrkInputParameters</network-input-parameters> </network-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() } - + String sndcTopologyCreateRequesAsString = utils.formatXml(sdncTopologyCreateRequest) - msoLogger.debug(sndcTopologyCreateRequesAsString) + utils.logAudit(sndcTopologyCreateRequesAsString) execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString) msoLogger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString) @@ -345,8 +459,8 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.trace("Exit prepareSDNCRequest ") - } + msoLogger.info(" ***** Exit prepareSDNCRequest *****") + } private void setProgressUpdateVariables(DelegateExecution execution, String body) { def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") @@ -368,17 +482,17 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String body = """ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:ns="http://org.onap.so/requestsdb"> + xmlns:ns="http://org.openecomp.mso/requestsdb"> <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <operType>${MsoUtils.xmlEscape(operType)}</operType> - <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> - <progress>${MsoUtils.xmlEscape(progress)}</progress> - <resourceTemplateUUID>${MsoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID> - <serviceId>${MsoUtils.xmlEscape(ServiceInstanceId)}</serviceId> - <status>${MsoUtils.xmlEscape(status)}</status> - <statusDescription>${MsoUtils.xmlEscape(statusDescription)}</statusDescription> + <operType>${msoUtils.xmlEncode(operType)}</operType> + <operationId>${msoUtils.xmlEncode(operationId)}</operationId> + <progress>${msoUtils.xmlEncode(progress)}</progress> + <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID> + <serviceId>${msoUtils.xmlEncode(ServiceInstanceId)}</serviceId> + <status>${msoUtils.xmlEncode(status)}</status> + <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; @@ -395,23 +509,23 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String operationId = resourceInputObj.getOperationId() String progress = "100" String status = "finished" - String statusDescription = "SDCN resource creation completed" + String statusDescription = "SDCN resource creation and activation completed" execution.getVariable("operationId") String body = """ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:ns="http://org.onap.so/requestsdb"> + xmlns:ns="http://org.openecomp.mso/requestsdb"> <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <operType>${MsoUtils.xmlEscape(operType)}</operType> - <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> - <progress>${MsoUtils.xmlEscape(progress)}</progress> - <resourceTemplateUUID>${MsoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID> - <serviceId>${MsoUtils.xmlEscape(ServiceInstanceId)}</serviceId> - <status>${MsoUtils.xmlEscape(status)}</status> - <statusDescription>${MsoUtils.xmlEscape(statusDescription)}</statusDescription> + <operType>${msoUtils.xmlEncode(operType)}</operType> + <operationId>${msoUtils.xmlEncode(operationId)}</operationId> + <progress>${msoUtils.xmlEncode(progress)}</progress> + <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID> + <serviceId>${msoUtils.xmlEncode(ServiceInstanceId)}</serviceId> + <status>${msoUtils.xmlEncode(status)}</status> + <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; @@ -419,32 +533,70 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { setProgressUpdateVariables(execution, body) } - public void postCreateSDNCCall(DelegateExecution execution){ - msoLogger.trace("Started prepareSDNCRequest ") + public void afterCreateSDNCCall(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started prepareSDNCRequest *****") String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") - + + def isActivateRequried = execution.getVariable("isActivateRequired") + if (StringUtils.equalsIgnoreCase(isActivateRequried, "true")) { + def instnaceId = getInstnaceId(execution) + execution.setVariable("networkInstanceId", instnaceId) + } + msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) - msoLogger.trace("Exit prepareSDNCRequest ") + msoLogger.info(" ***** Exit prepareSDNCRequest *****") + } + + private def getInstnaceId(DelegateExecution execution) { + def responce = new XmlSlurper().parseText(execution.getVariable("CRENWKI_createSDNCResponse")) + def data = responce.toString() + data = data.substring(data.indexOf("<")) + + def resp = new XmlSlurper().parseText(data) + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + def val = "" + + switch (modelName) { + case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ : + case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ : + val = resp."network-response-information"."instance-id" + break + + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + case ~/[\w\s\W]*Site[\w\s\W]*/: + val = resp."vnf-response-information"."instance-id" + break + + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/: + val = resp."connection-attachment-response-information"."instance-id" + break + } + + return val.toString() + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.debug(" *** sendSyncResponse *** ") + + try { + String operationStatus = "finished" + // RESTResponse for main flow + String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() + msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) + sendWorkflowResponse(execution, 202, resourceOperationResp) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.debug(" ***** Exit sendSyncResopnse *****") } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) - - try { - String operationStatus = "finished" - // RESTResponse for main flow - String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) - sendWorkflowResponse(execution, 202, resourceOperationResp) - execution.setVariable("sentSyncResponse", true) - - } catch (Exception ex) { - String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) - } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy index a63aad14a2..b6ea9f3fef 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy @@ -32,14 +32,15 @@ import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.logger.MsoLogger /** * This groovy class supports the <class>ActivateSDNCCNetworkResource.bpmn</class> process. * flow for SDNC Network Resource Activate */ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, - CreateSDNCNetworkResource.class); + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeActivateSDNCNetworkResource.class); String Prefix = "DEACTSDNCRES_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -48,21 +49,22 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + MsoUtils msoUtils = new MsoUtils() + public void preProcessRequest(DelegateExecution execution) { - msoLogger.info(" ***** started preProcessRequest*****") + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started preProcessRequest *****") try { //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") - msoLogger.info("The requestAction is: " + requestAction) String recipeParamsFromRequest = execution.getVariable("recipeParams") - msoLogger.info("The recipeParams is: " + recipeParamsFromRequest) String resourceInput = execution.getVariable("resourceInput") - msoLogger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object - org.onap.so.bpmn.common.recipe.ResourceInput resourceInputObj = org.onap.so.bpmn.common.resource.ResourceRequestBuilder.getJsonObject(resourceInput, org.onap.so.bpmn.common.recipe.ResourceInput.class) + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) execution.setVariable(Prefix + "resourceInput", resourceInputObj) //Deal with recipeParams @@ -82,7 +84,40 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor // TODO: based on the resource type decide action and operation type String sdnc_svcAction = "deactivate" - operationType = "SOTNConnectivity" + switch (resourceInputObj.getResourceModelInfo().getModelName()) { + case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ : + operationType = "SOTNConnectivity" + break + + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + operationType = "SOTNAttachment" + break + + case ~/[\w\s\W]*SiteVF[\w\s\W]*/ : + operationType = "Site" + break + + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + operationType = "SDWANDevice" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ : + operationType = "SDWANConnectivity" + break + + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + operationType = "SDWANAttachment" + break + + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + operationType = "SDWANPort" + execution.setVariable("isActivateRequired", "true") + break + + default: + break + } String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" execution.setVariable(Prefix + "svcAction", sdnc_svcAction) @@ -102,7 +137,8 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor } public void prepareSDNCRequest(DelegateExecution execution) { - msoLogger.info(" ***** started prepareSDNCRequest *****") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started prepareSDNCRequest *****") try { // get variables @@ -115,7 +151,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") String source = execution.getVariable("source") String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") - org.onap.so.bpmn.common.recipe.ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") String serviceType = resourceInputObj.getServiceType() String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid() @@ -127,175 +163,164 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() String modelName = resourceInputObj.getResourceModelInfo().getModelName() String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion() + String resourceInstnaceId = resourceInputObj.getResourceInstancenUuid() // 1. prepare assign topology via SDNC Adapter SUBFLOW call String sdncTopologyDeleteRequest = "" switch (modelName) { - case ~/^Site$/: + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteVF[\w\s\W]*/: sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> - <subscriber-name></subscriber-name> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEncode(globalCustomerId)}</subscriber-name> </service-information> <vnf-information> - <!-- TODO: to be filled as per the request input --> - <vnf-id></vnf-id> + <vnf-id>$resourceInstnaceId</vnf-id> <vnf-type></vnf-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> - </network-information> + </vnf-information> <vnf-request-input> - <request-version></request-version> - <vnf-name></vnf-name> - <vnf-networks> - <vnf-network> - <network-role></network-role> - <network-name></network-name> - <neutron-id></neutron-id> - <network-id></network-id> - <contrail-network-fqdn></contrail-network-fqdn> - <subnets-data> - <subnet-data> - <ip-version></ip-version> - <subnet-id></subnet-id> - </subnet-data> - </subnets-data> - </vnf-network> + <vnf-input-parameters> + </vnf-input-parameters> + <request-version></request-version> + <vnf-name></vnf-name> + <vnf-networks> </vnf-networks> - </vnf-request-input> - <vnf-input-parameters> - <param></param> - </vnf-input-parameters> + </vnf-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break - case ~/^SOTNAttachment$/: + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> <subscriber-name></subscriber-name> </service-information> <allotted-resource-information> - <!-- TODO: to be filled as per the request input --> - <allotted-resource-id></allotted-resource-id> + <allotted-resource-id>$resourceInstnaceId</allotted-resource-id> <allotted-resource-type></allotted-resource-type> <parent-service-instance-id></parent-service-instance-id> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> </allotted-resource-information> <connection-attachment-request-input> - <param></param> </connection-attachment-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break + default: sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> </service-information> <network-information> + <network-id>$resourceInstnaceId</network-id> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> </network-information> <network-request-input> @@ -305,10 +330,10 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor </aetgt:SDNCAdapterWorkflowRequest>""".trim() } - String sndcTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest) - utils.logAudit(sndcTopologyDeleteRequesAsString) - execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString) - msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString) + String sdncTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest) + utils.logAudit(sdncTopologyDeleteRequesAsString) + execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyDeleteRequesAsString) + msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyDeleteRequesAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DeleteSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() @@ -320,32 +345,30 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor } public void prepareUpdateAfterDeActivateSDNCResource(DelegateExecution execution) { - msoLogger.info("***** started prepareUpdateAfterDeActivateSDNCResource *****") - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() String serviceInstanceId = resourceInputObj.getServiceInstanceId() String operationId = resourceInputObj.getOperationId() - String progress = "100" - String status = "finished" - String statusDescription = "SDCN resource delete completed" + String progress = "50" + String status = "deactivated" + String statusDescription = "SDCN resource deactivation completed" //String operationId = execution.getVariable("operationId") String body = """ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:ns="http://org.onap.so/requestsdb"> + xmlns:ns="http://org.openecomp.mso/requestsdb"> <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <operType>${MsoUtils.xmlEscape(operType)}</operType> - <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> - <progress>${MsoUtils.xmlEscape(progress)}</progress> - <resourceTemplateUUID>${MsoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID> - <serviceId>${MsoUtils.xmlEscape(serviceInstanceId)}</serviceId> - <status>${MsoUtils.xmlEscape(status)}</status> - <statusDescription>${MsoUtils.xmlEscape(statusDescription)}</statusDescription> + <operType>${msoUtils.xmlEncode(operType)}</operType> + <operationId>${msoUtils.xmlEncode(operationId)}</operationId> + <progress>${msoUtils.xmlEncode(progress)}</progress> + <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID> + <serviceId>${msoUtils.xmlEncode(serviceInstanceId)}</serviceId> + <status>${msoUtils.xmlEncode(status)}</status> + <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; @@ -353,9 +376,15 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor setProgressUpdateVariables(execution, body) } + private void setProgressUpdateVariables(DelegateExecution execution, String body) { + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + execution.setVariable("CVFMI_updateResOperStatusRequest", body) + } + public void postDeactivateSDNCCall(DelegateExecution execution) { - msoLogger.info(" ***** started postDeactivateSDNCCall *****") - String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started prepareSDNCRequest *****") String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) @@ -363,8 +392,8 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor } public void sendSyncResponse(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - msoLogger.info(" ***** started sendSyncResponse *****") + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.debug(" *** sendSyncResponse *** ") try { String operationStatus = "finished" @@ -379,7 +408,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.debug(" ***** Exit sendSyncResopnse *****") + msoLogger("DEBUG"," ***** Exit sendSyncResopnse *****") } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy index 37c7d4d29a..06346ea81e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 * @@ -20,12 +20,12 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.json.JSONArray import org.json.JSONObject import org.json.XML import static org.apache.commons.lang3.StringUtils.* import groovy.xml.XmlUtil -import groovy.json.* import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.ExternalAPIUtil @@ -37,7 +37,6 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder import org.onap.so.rest.APIResponse -import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory import java.util.UUID import org.onap.so.logger.MsoLogger @@ -77,26 +76,29 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String resourceInput = execution.getVariable("resourceInput") msoLogger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object - ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) // set local resourceInput execution.setVariable(Prefix + "ResourceInput", resourceInputObj) String resourceInstanceId = resourceInputObj.getResourceInstancenUuid() + String sppartnerId = resourceInstanceId + execution.setVariable(Prefix + "SppartnerId", sppartnerId) // Get Sppartner from AAI - AaiUtil aaiUriUtil = new AaiUtil(this) + AaiUtil aaiUriUtil = new AaiUtil() String aai_uri = aaiUriUtil.getBusinessSPPartnerUri(execution) String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) String aai_endpoint = execution.getVariable("URN_aai_endpoint") String serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(sppartnerId,"UTF-8") - execution.setVariable(Prefix + "serviceAaiPath", serviceAaiPath) + execution.setVariable(Prefix + "ServiceAaiPath", serviceAaiPath) getSPPartnerInAAI(execution) String callSource = "UUI" String sppartnerUrl = "" - if(execution.getVariable(Prefix + "SuccessIndicator")) { + if(execution.hasVariable(Prefix + "CallSource")) { callSource = execution.getVariable(Prefix + "CallSource") + sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") } boolean is3rdONAPExist = false @@ -131,15 +133,15 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso public void preProcessRequest(DelegateExecution execution){ msoLogger.info(" ***** Started preProcessRequest *****") + String msg = "" + try { - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") - String msg = "" + ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") String globalSubscriberId = resourceInputObj.getGlobalSubscriberId() if (isBlank(globalSubscriberId)) { msg = "Input globalSubscriberId is null" - msoLogger.info( msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + msoLogger.error( msg) } //set local variable execution.setVariable("globalSubscriberId", globalSubscriberId) @@ -148,8 +150,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String serviceType = resourceInputObj.getServiceType() if (isBlank(serviceType)) { msg = "Input serviceType is null" - msoLogger.info( msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + msoLogger.error( msg) } execution.setVariable("serviceType", serviceType) msoLogger.info( "serviceType:" + serviceType) @@ -157,26 +158,23 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String operationId = resourceInputObj.getOperationId() if (isBlank(operationId)) { msg = "Input operationId is null" - msoLogger.info( msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + msoLogger.error( msg) } execution.setVariable("operationId", operationId) msoLogger.info( "operationId:" + operationId) - String resourceName = resourceInputObj.getResourceInstanceName() + String resourceName = resourceInputObj.getResourceInstanceName() if (isBlank(resourceName)) { msg = "Input resourceName is null" - msoLogger.info( msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + msoLogger.error( msg) } execution.setVariable("resourceName", resourceName) - msoLogger.info( "resourceInstanceId:" + resourceName) + msoLogger.info("resourceName:" + resourceName) String resourceTemplateId = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() if (isBlank(resourceTemplateId)) { msg = "Input resourceTemplateId is null" - msoLogger.info( msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + msoLogger.error( msg) } execution.setVariable("resourceTemplateId", resourceTemplateId) msoLogger.info( "resourceTemplateId:" + resourceTemplateId) @@ -184,7 +182,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } catch (BpmnError e) { throw e } catch (Exception ex){ - String msg = "Exception in preProcessRequest " + ex.getMessage() + msg = "Exception in preProcessRequest " + ex.getMessage() msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } @@ -227,7 +225,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso msoLogger.info(" ***** Started prepare3rdONAPRequest *****") String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") - String extAPIPath = sppartnerUrl + 'serviceOrder' + String extAPIPath = sppartnerUrl + '/serviceOrder' execution.setVariable("ExternalAPIURL", extAPIPath) // ExternalAPI message format @@ -238,8 +236,8 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String requestedCompletionDate = utils.generateCurrentTimeInUtc() String priority = "1" // 0-4 0:highest String subscriberId = execution.getVariable("globalSubscriberId") - String customerRole = "" - String subscriberName = "" + String customerRole = "ONAPcustomer" + String subscriberName = subscriberId String referredType = "Consumer" String orderItemId = "1" String action = "delete" //for delete @@ -249,7 +247,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String serviceId = execution.getVariable(Prefix + "SppartnerId") queryServicefrom3rdONAP(execution) - String serviceUuId = execution.getVariable(Prefix + "serviceSpecificationId") + String serviceSpecificationId = execution.getVariable(Prefix + "ServiceSpecificationId") Map<String, String> valueMap = new HashMap<>() valueMap.put("externalId", '"' + externalId + '"') @@ -266,11 +264,10 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso valueMap.put("action", '"' + action + '"') valueMap.put("serviceState", '"' + serviceState + '"') valueMap.put("serviceId", '"' + serviceId + '"') - valueMap.put("serviceName", '"' + serviceName + '"') - valueMap.put("serviceType", '"' + serviceType + '"') - valueMap.put("serviceUuId", '"' + serviceUuId + '"') + valueMap.put("serviceName", "null") + valueMap.put("serviceUuId", '"' + serviceSpecificationId + '"') - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() valueMap.put("_requestInputs_", "") @@ -283,32 +280,45 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso { msoLogger.info(" ***** Started queryServicefrom3rdONAP *****") - //https://{api_url}/nbi/api/v1/service/{serviceinstanceid} + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String SppartnerServiceId = execution.getVariable(Prefix + "SppartnerId") + + //https://{api_url}/nbi/api/v1/service?relatedParty.id=${globalSubscriberId} String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") - String extAPIPath = sppartnerUrl + "service/" + execution.setVariable(Prefix + "SppartnerId") - - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) + String extAPIPath = sppartnerUrl + "/service?relatedParty.id=" + globalSubscriberId + msoLogger.debug("queryServicefrom3rdONAP externalAPIURL is: " + extAPIPath) + + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) int responseCode = response.getStatusCode() - execution.setVariable(Prefix + "getServiceResponseCode", responseCode) - utils.log("DEBUG", "Get Service response code is: " + responseCode) + execution.setVariable(Prefix + "GetServiceResponseCode", responseCode) + msoLogger.debug("Get Service response code is: " + responseCode) String extApiResponse = response.getResponseBodyAsString() - JSONObject responseObj = new JSONObject(extApiResponse) - execution.setVariable(Prefix + "getServiceResponse", extApiResponse) + + execution.setVariable(Prefix + "GetServiceResponse", extApiResponse) + msoLogger.debug("queryServicefrom3rdONAP response body is: " + extApiResponse) //Process Response //200 OK 201 CREATED 202 ACCEPTED if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) { - utils.log("DEBUG", "Get Service Received a Good Response") - String serviceUuid = responseObj.get("serviceSpecification.id") - execution.setVariable(Prefix + "serviceSpecificationId", serviceUuid) + msoLogger.debug("Get Service Received a Good Response") + JSONArray responseList = new JSONArray(extApiResponse) + for(JSONObject obj : responseList) { + String svcId = obj.get("id") + if(StringUtils.equalsIgnoreCase(SppartnerServiceId, svcId)) { + JSONObject serviceSpecification = obj.get("serviceSpecification") + String serviceUuid = serviceSpecification.get("id") + execution.setVariable(Prefix + "ServiceSpecificationId", serviceUuid) + break + } + } } else{ - utils.log("DEBUG", "Get Service Received a Bad Response Code. Response Code is: " + responseCode) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Service Received a bad response from 3rdONAP External API") + msoLogger.error("Get Service Received a Bad Response Code. Response Code is: " + responseCode) +// exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Service Received a bad response from 3rdONAP External API") } msoLogger.info( "Exit " + queryServicefrom3rdONAP) @@ -319,29 +329,35 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String extAPIPath = execution.getVariable("ExternalAPIURL") String payload = execution.getVariable(Prefix + "Payload") + msoLogger.debug("doDeleteE2ESIin3rdONAP externalAPIURL is: " + extAPIPath) + msoLogger.debug("doDeleteE2ESIin3rdONAP payload is: " + payload) - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() APIResponse response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload) int responseCode = response.getStatusCode() - execution.setVariable(Prefix + "postServiceOrderResponseCode", responseCode) + execution.setVariable(Prefix + "PostServiceOrderResponseCode", responseCode) msoLogger.debug("Post ServiceOrder response code is: " + responseCode) String extApiResponse = response.getResponseBodyAsString() JSONObject responseObj = new JSONObject(extApiResponse) - execution.setVariable(Prefix + "postServiceOrderResponse", extApiResponse) + execution.setVariable(Prefix + "PostServiceOrderResponse", extApiResponse) + + msoLogger.debug("doDeleteE2ESIin3rdONAP response body is: " + extApiResponse) + //Process Response if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) //200 OK 201 CREATED 202 ACCEPTED { msoLogger.debug("Post ServiceOrder Received a Good Response") - String serviceOrderId = responseObj.get("ServiceOrderId") + String serviceOrderId = responseObj.get("id") execution.setVariable(Prefix + "SuccessIndicator", true) - execution.setVariable("serviceOrderId", serviceOrderId) + execution.setVariable("ServiceOrderId", serviceOrderId) + msoLogger.info("Post ServiceOrderid is: " + serviceOrderId) } else{ - msoLogger.debug("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) + msoLogger.error("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API") } @@ -354,57 +370,85 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String extAPIPath = execution.getVariable("ExternalAPIURL") extAPIPath += "/" + execution.getVariable("ServiceOrderId") + msoLogger.debug("getE2ESIProgressin3rdONAP delete externalAPIURL is: " + extAPIPath) - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) int responseCode = response.getStatusCode() - execution.setVariable(Prefix + "getServiceOrderResponseCode", responseCode) + execution.setVariable(Prefix + "GetServiceOrderResponseCode", responseCode) msoLogger.debug("Get ServiceOrder response code is: " + responseCode) String extApiResponse = response.getResponseBodyAsString() JSONObject responseObj = new JSONObject(extApiResponse) - execution.setVariable(Prefix + "getServiceOrderResponse", extApiResponse) + execution.setVariable(Prefix + "GetServiceOrderResponse", extApiResponse) + utils.log("DEBUG", "getE2ESIProgressin3rdONAP delete response body is: " + extApiResponse, isDebugEnabled) + //Process Response //200 OK 201 CREATED 202 ACCEPTED - if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) { msoLogger.debug("Get ServiceOrder Received a Good Response") - String serviceOrderState = responseObj.get("State") + + String orderState = responseObj.get("state") + if("REJECTED".equalsIgnoreCase(orderState)) { + execution.setVariable("progress", 100) + execution.setVariable("status", "error") + execution.setVariable("statusDescription", "Delete Service Order Status is REJECTED") + return + } + + JSONArray items = responseObj.getJSONArray("orderItem") + JSONObject item = items[0] + JSONObject service = item.get("service") + String sppartnerServiceId = service.get("id") + if(sppartnerServiceId == null || sppartnerServiceId.equals("null")) { + execution.setVariable("progress", 100) + execution.setVariable("status", "error") + execution.setVariable("statusDescription", "Delete Service Order Status get null sppartnerServiceId") + msoLogger.error("null sppartnerServiceId while getting progress from externalAPI") + return + } + execution.setVariable(Prefix + "SppartnerServiceId", sppartnerServiceId) + + String serviceOrderState = item.get("state") execution.setVariable(Prefix + "SuccessIndicator", true) - execution.setVariable("serviceOrderState", serviceOrderState) - + execution.setVariable("ServiceOrderState", serviceOrderState) + // Get serviceOrder State and process progress if("ACKNOWLEDGED".equalsIgnoreCase(serviceOrderState)) { execution.setVariable("progress", 15) - execution.setVariable("status", "processing") + execution.setVariable("status", "processing") + execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState) } - if("INPROGRESS".equalsIgnoreCase(serviceOrderState)) { + else if("INPROGRESS".equalsIgnoreCase(serviceOrderState)) { execution.setVariable("progress", 40) execution.setVariable("status", "processing") + execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState) } - if("COMPLETED".equalsIgnoreCase(serviceOrderState)) { + else if("COMPLETED".equalsIgnoreCase(serviceOrderState)) { execution.setVariable("progress", 100) execution.setVariable("status", "finished") + execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState) } - if("FAILED".equalsIgnoreCase(serviceOrderState)) { + else if("FAILED".equalsIgnoreCase(serviceOrderState)) { execution.setVariable("progress", 100) execution.setVariable("status", "error") + execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState) } else { execution.setVariable("progress", 100) execution.setVariable("status", "error") execution.setVariable("statusDescription", "Delete Service Order Status is unknown") } - execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState) } else{ msoLogger.debug("Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) execution.setVariable("progress", 100) execution.setVariable("status", "error") - execution.setVariable("statusDescription", "Get ServiceOrder Received a bad response") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get ServiceOrder Received a bad response from 3rdONAP External API") + execution.setVariable("statusDescription", "Get Delete ServiceOrder Received a bad response") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Delete ServiceOrder Received a bad response from 3rdONAP External API") } msoLogger.info( "Exit " + getE2ESIProgressin3rdONAP) @@ -417,15 +461,15 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso try { Thread.sleep(5000) } catch(InterruptedException e) { - utils.log("ERROR", "Time Delay exception" + e ) + msoLogger.error("Time Delay exception" + e ) } } private void getSPPartnerInAAI(DelegateExecution execution) { - msoLogger.info(" ***** Started postDeleteE2ESIin3rdONAP *****") + msoLogger.info(" ***** Started getSPPartnerInAAI *****") - AaiUtil aaiUriUtil = new AaiUtil(this) - String serviceAaiPath = execution.getVariable(Prefix + "serviceAaiPath") + AaiUtil aaiUriUtil = new AaiUtil() + String serviceAaiPath = execution.getVariable(Prefix + "ServiceAaiPath") APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceAaiPath) int responseCode = response.getStatusCode() execution.setVariable(Prefix + "GetSppartnerResponseCode", responseCode) @@ -444,13 +488,13 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable(Prefix + "SuccessIndicator", true) execution.setVariable(Prefix + "FoundIndicator", true) - String sppartnerId = utils.getNodeText1(aaiResponse, "sppartner-id") + String sppartnerId = utils.getNodeText1(aaiResponse, "sp-partner-id") execution.setVariable(Prefix + "SppartnerId", sppartnerId) msoLogger.debug(" SppartnerId is: " + sppartnerId) - String sppartnerUrl = utils.getNodeText1(aaiResponse, "sppartner-url") + String sppartnerUrl = utils.getNodeText1(aaiResponse, "url") execution.setVariable(Prefix + "SppartnerUrl", sppartnerUrl) msoLogger.debug(" SppartnerUrl is: " + sppartnerUrl) - String callSource = utils.getNodeText1(aaiResponse, "sppartner-callsource") + String callSource = utils.getNodeText1(aaiResponse, "callsource") execution.setVariable(Prefix + "CallSource", callSource) msoLogger.debug(" CallSource is: " + callSource) String sppartnerVersion = utils.getNodeText1(aaiResponse, "resource-version") @@ -460,22 +504,22 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso else { msoLogger.debug("Get sppartner Received a Bad Response Code. Response Code is: " + responseCode) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") +// exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) +// throw new BpmnError("MSOWorkflowException") } - msoLogger.info( "Exit " + deleteSPPartnerInAAI) + msoLogger.info( "Exit " + getSPPartnerInAAI) } public void deleteSPPartnerInAAI(DelegateExecution execution) { - msoLogger.info(" ***** Started postDeleteE2ESIin3rdONAP *****") + msoLogger.info(" ***** Started deleteSPPartnerInAAI *****") String sppartnerId = execution.getVariable(Prefix + "SppartnerId") - String sppartnerUrl = execution.getVariable(Prefix + "sppartnerUrl") - String sppartnerVersion = execution.getVariable(Prefix + "sppartnerVersion") + String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") + String sppartnerVersion = execution.getVariable(Prefix + "SppartnerVersion") - AaiUtil aaiUriUtil = new AaiUtil(this) - String serviceAaiPath = execution.getVariable(Prefix + "serviceAaiPath") + "?resource-version=${sppartnerVersion}" + AaiUtil aaiUriUtil = new AaiUtil() + String serviceAaiPath = execution.getVariable(Prefix + "ServiceAaiPath") + "?resource-version=${sppartnerVersion}" APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, serviceAaiPath) int responseCode = response.getStatusCode() execution.setVariable(Prefix + "DeleteSppartnerResponseCode", responseCode) @@ -486,8 +530,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable(Prefix + "DeleteSppartnerResponse", aaiResponse) //Process Response - if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) - //200 OK 201 CREATED 202 ACCEPTED + if(responseCode == 200 || responseCode == 204 ) { msoLogger.debug("Delete sppartner Received a Good Response") execution.setVariable(Prefix + "SuccessIndicator", true) @@ -499,13 +542,13 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso else { msoLogger.debug("Delete sppartner Received a Bad Response Code. Response Code is: " + responseCode) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") +// exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) +// throw new BpmnError("MSOWorkflowException") } msoLogger.info( "Exit " + deleteSPPartnerInAAI) } - + private void setProgressUpdateVariables(DelegateExecution execution, String body) { def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) @@ -514,8 +557,8 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso public void postProcess(DelegateExecution execution){ msoLogger.info(" ***** Started postProcess *****") - String responseCode = execution.getVariable(Prefix + "putSppartnerResponseCode") - String responseObj = execution.getVariable(Prefix + "putSppartnerResponse") + String responseCode = execution.getVariable(Prefix + "PutSppartnerResponseCode") + String responseObj = execution.getVariable(Prefix + "PutSppartnerResponse") msoLogger.info("response from AAI for put sppartner, response code :" + responseCode + " response object :" + responseObj) msoLogger.info(" ***** Exit postProcess *****") @@ -535,7 +578,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } catch (Exception ex) { String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } msoLogger.debug(" ***** Exit sendSyncResopnse *****") } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy index 5a21fd7396..71ce28d7d3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy @@ -25,7 +25,6 @@ import org.json.XML; import static org.apache.commons.lang3.StringUtils.*; import groovy.xml.XmlUtil -import groovy.json.* import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.recipe.ResourceInput; @@ -50,8 +49,8 @@ import org.onap.so.rest.APIResponse; import org.onap.so.bpmn.common.scripts.AaiUtil /** - * This groovy class supports the <class>CreateDeviceResource.bpmn</class> process. - * flow for Device Resource Create + * This groovy class supports the <class>DeleteDeviceResource.bpmn</class> process. + * flow for Device Resource Delete */ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { @@ -77,25 +76,21 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { msoLogger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) - execution.setVariable(Prefix + "resourceInput", resourceInputObj) + execution.setVariable(Prefix + "ResourceInput", resourceInputObj) String resourceInputPrameters = resourceInputObj.getResourceParameters() String inputParametersJson = jsonUtil.getJsonValue(resourceInputPrameters, "requestInputs") - JSONObject inputParameters = new JSONObject(customizeResourceParam(inputParametersJson)) - execution.setVariable(Prefix + "resourceRequestInputs", inputParameters) + JSONObject inputParameters = new JSONObject(inputParametersJson) + execution.setVariable(Prefix + "ResourceRequestInputs", inputParameters) //Deal with recipeParams String recipeParamsFromWf = execution.getVariable("recipeParamXsd") String resourceName = resourceInputObj.getResourceInstanceName() - //For sdnc requestAction default is "createNetworkInstance" - String operationType = "Network" - if(!StringUtils.isBlank(recipeParamsFromRequest)){ - //the operationType from worflow(first node) is second priority. - operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") - } - if(!StringUtils.isBlank(recipeParamsFromWf)){ - //the operationType from worflow(first node) is highest priority. - operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") - } + + String resourceInstanceId = resourceInputObj.getResourceInstancenUuid() + String deviceId = resourceInstanceId + execution.setVariable(Prefix + "DeviceId", deviceId) + + getDeviceInAAI(execution) execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) @@ -104,35 +99,58 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex){ String msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug( msg) + msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } - String customizeResourceParam(String networkInputParametersJson) { - List<Map<String, Object>> paramList = new ArrayList(); - JSONObject jsonObject = new JSONObject(networkInputParametersJson); - Iterator iterator = jsonObject.keys(); - while (iterator.hasNext()) { - String key = iterator.next(); - HashMap<String, String> hashMap = new HashMap(); - hashMap.put("name", key); - hashMap.put("value", jsonObject.get(key)) - paramList.add(hashMap) - } - Map<String, List<Map<String, Object>>> paramMap = new HashMap(); - paramMap.put("param", paramList); - - return new JSONObject(paramMap).toString(); - } + private void getDeviceInAAI(DelegateExecution execution) { + msoLogger.info(" ***** Started getDeviceInAAI *****") + + String deviceId = execution.getVariable(Prefix + "DeviceId") + AaiUtil aaiUriUtil = new AaiUtil() + String aai_uri = aaiUriUtil.getNetworkDeviceUri(execution) + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(deviceId,"UTF-8") + execution.setVariable(Prefix + "ServiceAaiPath", serviceAaiPath) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceAaiPath) + int responseCode = response.getStatusCode() + execution.setVariable(Prefix + "GetDeviceResponseCode", responseCode) + msoLogger.debug(" Get device response code is: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) + aaiResponse = aaiResponse.replaceAll("&", "&") + execution.setVariable(Prefix + "GetDeviceResponse", aaiResponse) + + //Process Response + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + //200 OK 201 CREATED 202 ACCEPTED + { + msoLogger.debug("GET Device Received a Good Response") + execution.setVariable(Prefix + "SuccessIndicator", true) + execution.setVariable(Prefix + "FoundIndicator", true) + + String devClass = utils.getNodeText1(aaiResponse, "device_class") + execution.setVariable(Prefix + "DeviceClass", devClass) + msoLogger.debug(" DeviceClass is: " + devClass) + + } + else + { + msoLogger.debug("Get DeviceInAAI Received a Bad Response Code. Response Code is: " + responseCode) + + } + + msoLogger.info(" ***** Exit getDeviceInAAI *****") + } public void checkDevType(DelegateExecution execution){ - utils.log("INFO"," ***** Started checkDevType *****") + msoLogger.info(" ***** Started checkDevType *****") try { - JSONObject inputParameters = execution.getVariable(Prefix + "resourceRequestInputs") - - String devType = inputParameters.get("device_class") + String devType = execution.getVariable(Prefix + "DeviceClass") if(StringUtils.isBlank(devType)) { devType = "OTHER" @@ -147,8 +165,47 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { } } + private void setProgressUpdateVariables(DelegateExecution execution, String body) { + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + execution.setVariable("CVFMI_updateResOperStatusRequest", body) + } + + public void prepareUpdateProgress(DelegateExecution execution) { + msoLogger.info(" ***** Started prepareUpdateProgress *****") + ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") + String operType = resourceInputObj.getOperationType() + String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String ServiceInstanceId = resourceInputObj.getServiceInstanceId() + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + String operationId = resourceInputObj.getOperationId() + String progress = execution.getVariable("progress") + String status = execution.getVariable("status") + String statusDescription = execution.getVariable("statusDescription") + + String body = """ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.openecomp.mso/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:updateResourceOperationStatus> + <operType>${operType}</operType> + <operationId>${operationId}</operationId> + <progress>${progress}</progress> + <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID> + <serviceId>${ServiceInstanceId}</serviceId> + <status>${status}</status> + <statusDescription>${statusDescription}</statusDescription> + </ns:updateResourceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + setProgressUpdateVariables(execution, body) + msoLogger.info(" ***** Exit prepareUpdateProgress *****") + } + public void getVNFTemplatefromSDC(DelegateExecution execution){ - utils.log("INFO"," ***** Started getVNFTemplatefromSDC *****") + msoLogger.info(" ***** Started getVNFTemplatefromSDC *****") try { // To do @@ -161,7 +218,7 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { } public void postVNFInfoProcess(DelegateExecution execution){ - utils.log("INFO"," ***** Started postVNFInfoProcess *****") + msoLogger.info(" ***** Started postVNFInfoProcess *****") try { // To do diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy index 04b62d7f73..192788a4ca 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy @@ -34,6 +34,8 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.logger.MsoLogger import groovy.json.* @@ -42,21 +44,23 @@ import groovy.json.* * flow for SDNC Network Resource */ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, - CreateSDNCNetworkResource.class); + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteSDNCNetworkResource.class); String Prefix="DELSDNCRES_" - + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - + + MsoUtils msoUtils = new MsoUtils() + public void preProcessRequest(DelegateExecution execution){ - msoLogger.info("***** Started preProcessRequest *****") - try { - + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started preProcessRequest *****") + try { + //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") @@ -68,12 +72,12 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) execution.setVariable(Prefix + "resourceInput", resourceInputObj) - + //Deal with recipeParams String recipeParamsFromWf = execution.getVariable("recipeParamXsd") - String resourceModelName = resourceInputObj.getResourceModelInfo().getModelName() + String resourceModelName = resourceInputObj.getResourceModelInfo().getModelName() //For sdnc requestAction default is "NetworkInstance" - String operationType = "Network" + String operationType = "Network" if(!StringUtils.isBlank(recipeParamsFromRequest) && "null" != recipeParamsFromRequest){ //the operationType from worflow(first node) is second priority. operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") @@ -82,36 +86,78 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { //the operationType from worflow(first node) is highest priority. operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") } - - + + //For sdnc, generate svc_action and request_action String sdnc_svcAction = "delete" - if(StringUtils.containsIgnoreCase(resourceModelName, "overlay")){ - //This will be resolved in R3. - sdnc_svcAction ="deactivate" - operationType = "NCINetwork" + switch (resourceInputObj.getResourceModelInfo().getModelName()) { + + case ~/[\w\s\W]*overlay[\w\s\W]*/ : + ///This will be resolved in R3. + sdnc_svcAction ="deactivate" + operationType = "NCINetwork" + break + + case ~/[\w\s\W]*underlay[\w\s\W]*/ : + //This will be resolved in R3. + operationType ="Network" + break + + case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ : + operationType = "SOTNConnectivity" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + operationType = "SOTNAttachment" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SiteVF[\w\s\W]*/ : + operationType = "Site" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + operationType = "SDWANDevice" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ : + operationType = "SDWANConnectivity" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + operationType = "SDWANAttachment" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + operationType = "SDWANPort" + execution.setVariable("isActivateRequired", "true") + break + + default: + break } - if(StringUtils.containsIgnoreCase(resourceModelName, "underlay")){ - //This will be resolved in R3. - operationType ="Network" - } - String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" - execution.setVariable(Prefix + "svcAction", sdnc_svcAction) + String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" + execution.setVariable(Prefix + "svcAction", sdnc_svcAction) execution.setVariable(Prefix + "requestAction", sdnc_requestAction) execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) //TODO Here build networkrequest - + } catch (BpmnError e) { throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + msoLogger.debug( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } - + /** * Pre Process the BPMN Flow Request * Inclouds: @@ -119,11 +165,12 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { * generate the nsParameters */ public void prepareSDNCRequest (DelegateExecution execution) { - msoLogger.info("***** Started prepareSDNCRequest *****") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started prepareSDNCRequest *****") try { // get variables - String sdnc_svcAction = execution.getVariable(Prefix + "svcAction") + String sdnc_svcAction = execution.getVariable(Prefix + "svcAction") String sdnc_requestAction = execution.getVariable(Prefix + "requestAction") String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") @@ -144,177 +191,164 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() String modelName = resourceInputObj.getResourceModelInfo().getModelName() String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion() + String resourceInstnaceId = resourceInputObj.getResourceInstancenUuid() // 1. prepare assign topology via SDNC Adapter SUBFLOW call - String sndcTopologyDeleteRequest = "" + String sdncTopologyDeleteRequest = "" switch (modelName) { - case ~/^Site$/: - sndcTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteVF[\w\s\W]*/: + sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> - <subscriber-name></subscriber-name> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEncode(globalCustomerId)}</subscriber-name> </service-information> <vnf-information> - <!-- TODO: to be filled as per the request input --> - <vnf-id></vnf-id> + <vnf-id>$resourceInstnaceId</vnf-id> <vnf-type></vnf-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> </vnf-information> <vnf-request-input> - <request-version></request-version> - <vnf-name></vnf-name> - <vnf-networks> - <vnf-network> - <network-role></network-role> - <network-name></network-name> - <neutron-id></neutron-id> - <network-id></network-id> - <contrail-network-fqdn></contrail-network-fqdn> - <subnets-data> - <subnet-data> - <ip-version></ip-version> - <subnet-id></subnet-id> - </subnet-data> - </subnets-data> - </vnf-network> + <vnf-input-parameters> + </vnf-input-parameters> + <request-version></request-version> + <vnf-name></vnf-name> + <vnf-networks> </vnf-networks> - </vnf-request-input> - <vnf-input-parameters> - <param></param> - </vnf-input-parameters> + </vnf-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break - case ~/^SOTNAttachment$/: - sndcTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> <subscriber-name></subscriber-name> </service-information> <allotted-resource-information> - <allotted-resource-id></allotted-resource-id> + <allotted-resource-id>$resourceInstnaceId</allotted-resource-id> <allotted-resource-type></allotted-resource-type> <parent-service-instance-id></parent-service-instance-id> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> </allotted-resource-information> <connection-attachment-request-input> - <param></param> </connection-attachment-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break default: - sndcTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> </service-information> <network-information> - <!-- TODO: to be filled as per the request input --> - <network-id></network-id> + <network-id>$resourceInstnaceId</network-id> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> </network-information> <network-request-input> @@ -324,19 +358,19 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { </aetgt:SDNCAdapterWorkflowRequest>""".trim() } - String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) - utils.logAudit(sndcTopologyDeleteRequesAsString) - execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString) - msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString) + String sdncTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest) + utils.logAudit(sdncTopologyDeleteRequesAsString) + execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyDeleteRequesAsString) + msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyDeleteRequesAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DeleteSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + msoLogger.debug( exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } msoLogger.info(" ***** Exit prepareSDNCRequest *****") - } + } private void setProgressUpdateVariables(DelegateExecution execution, String body) { def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") @@ -358,17 +392,17 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { String body = """ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:ns="http://org.onap.so/requestsdb"> + xmlns:ns="http://org.openecomp.mso/requestsdb"> <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <operType>${MsoUtils.xmlEscape(operType)}</operType> - <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> - <progress>${MsoUtils.xmlEscape(progress)}</progress> - <resourceTemplateUUID>${MsoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID> - <serviceId>${MsoUtils.xmlEscape(serviceInstanceId)}</serviceId> - <status>${MsoUtils.xmlEscape(status)}</status> - <statusDescription>${MsoUtils.xmlEscape(statusDescription)}</statusDescription> + <operType>${msoUtils.xmlEncode(operType)}</operType> + <operationId>${msoUtils.xmlEncode(operationId)}</operationId> + <progress>${msoUtils.xmlEncode(progress)}</progress> + <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID> + <serviceId>${msoUtils.xmlEncode(serviceInstanceId)}</serviceId> + <status>${msoUtils.xmlEncode(status)}</status> + <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; @@ -385,23 +419,23 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { String operationId = resourceInputObj.getOperationId() String progress = "100" String status = "finished" - String statusDescription = "SDCN resource delete completed" + String statusDescription = "SDCN resource delete and deactivation completed" //String operationId = execution.getVariable("operationId") String body = """ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:ns="http://org.onap.so/requestsdb"> + xmlns:ns="http://org.openecomp.mso/requestsdb"> <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <operType>${MsoUtils.xmlEscape(operType)}</operType> - <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> - <progress>${MsoUtils.xmlEscape(progress)}</progress> - <resourceTemplateUUID>${MsoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID> - <serviceId>${MsoUtils.xmlEscape(serviceInstanceId)}</serviceId> - <status>${MsoUtils.xmlEscape(status)}</status> - <statusDescription>${MsoUtils.xmlEscape(statusDescription)}</statusDescription> + <operType>${msoUtils.xmlEncode(operType)}</operType> + <operationId>${msoUtils.xmlEncode(operationId)}</operationId> + <progress>${msoUtils.xmlEncode(progress)}</progress> + <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID> + <serviceId>${msoUtils.xmlEncode(serviceInstanceId)}</serviceId> + <status>${msoUtils.xmlEncode(status)}</status> + <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; @@ -410,6 +444,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { } public void postDeleteSDNCCall(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") msoLogger.info(" ***** Started prepareSDNCRequest *****") String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") @@ -417,23 +452,24 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) msoLogger.info(" ***** Exit prepareSDNCRequest *****") } - - public void sendSyncResponse (DelegateExecution execution) { - msoLogger.info(" *** sendSyncResponse *** ") - - try { - String operationStatus = "finished" - // RESTResponse for main flow - String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) - sendWorkflowResponse(execution, 202, resourceOperationResp) - execution.setVariable("sentSyncResponse", true) - - } catch (Exception ex) { - String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - msoLogger.info(" ***** Exit sendSyncResopnse *****") - } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.debug( " *** sendSyncResponse *** ") + + try { + String operationStatus = "finished" + // RESTResponse for main flow + String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() + msoLogger.debug( " sendSyncResponse to APIH:" + "\n" + resourceOperationResp) + sendWorkflowResponse(execution, 202, resourceOperationResp) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + msoLogger.debug( msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.debug(" ***** Exit sendSyncResopnse *****") + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index 26b0fea6a2..4b848024d6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -332,38 +332,6 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { } } - - public void saveServiceInputToAAI(DelegateExecution execution) { - AaiUtil aaiUriUtil = new AaiUtil(this) - - // create url for AAI requestInput - String aai_uri = aaiUriUtil.getAAIServiceInstanceUri(execution) - String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String serviceInstanceName = execution.getVariable("serviceInstanceName") - String serviceType = execution.getVariable("serviceType") - String uuiRequest = execution.getVariable("uuiRequest") - - String payload = - """< xmlns=\"${namespace}\"> - <service-instance> - <service-instance-id>${serviceInstanceId}</service-instance-id> - <service-instance-name>${serviceInstanceName}</service-instance-name> - <service-type>${serviceType}</service-type> - <customer-request>${uuiRequest}</customer-request> - </service-instance>""".trim() - utils.logAudit(payload) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(serviceInstanceId,"UTF-8") - - APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload) - int responseCode = response.getStatusCode() - execution.setVariable(Prefix + "PutSppartnerResponseCode", responseCode) - } - - public void postProcessAAIGET2(DelegateExecution execution) { msoLogger.trace("postProcessAAIGET2 ") String msg = "" diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy index 17dbe50cc5..482da23b33 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy @@ -104,7 +104,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ String serviceModelUUID = execution.getVariable("modelUuid") - List<Resource> addResourceList = execution.getVariable("addResourceList") + List<Resource> addResourceList = execution.getVariable("addResourceList") List<NetworkResource> networkResourceList = new ArrayList<NetworkResource>() @@ -149,17 +149,22 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ } String isContainsWanResource = networkResourceList.isEmpty() ? "false" : "true" + //if no networkResource, get SDNC config from properties file + if( "false".equals(isContainsWanResource)) { + String serviceNeedSDNC = "mso.workflow.custom." + serviceModelName + ".sdnc.need"; + isContainsWanResource = BPMNProperties.getProperty(serviceNeedSDNC, isContainsWanResource) + } + execution.setVariable("isContainsWanResource", isContainsWanResource) execution.setVariable("currentResourceIndex", 0) execution.setVariable("sequencedResourceList", sequencedResourceList) msoLogger.info("sequencedResourceList: " + sequencedResourceList) msoLogger.trace("COMPLETED sequenceResoure Process ") - } - + } + public prepareServiceTopologyRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start prepareServiceTopologyRequest Process ======== ", isDebugEnabled) + msoLogger.trace("======== Start prepareServiceTopologyRequest Process ======== ") String serviceDecompose = execution.getVariable("serviceDecomposition") @@ -174,7 +179,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ execution.setVariable("modelUuid", serviceUuid) execution.setVariable("serviceModelName", serviceModelName) - utils.log("INFO", "======== End prepareServiceTopologyRequest Process ======== ", isDebugEnabled) + msoLogger.trace("======== End prepareServiceTopologyRequest Process ======== ") } public void getCurrentResoure(DelegateExecution execution){ @@ -205,7 +210,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ msoLogger.trace("Start prepareResourceRecipeRequest Process ") ResourceInput resourceInput = new ResourceInput() String serviceInstanceName = execution.getVariable("serviceInstanceName") - String resourceType = execution.getVariable("resourceType") + String resourceType = execution.getVariable("resourceType") String resourceInstanceName = resourceType + "_" + serviceInstanceName resourceInput.setResourceInstanceName(resourceInstanceName) msoLogger.info("Prepare Resource Request resourceInstanceName:" + resourceInstanceName) @@ -252,19 +257,19 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ String requestAction = "createInstance" JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceModelInfo().getModelUuid(), requestAction) - if (resourceRecipe != null) { - String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + resourceRecipe.getString("orchestrationUri") - int recipeTimeOut = resourceRecipe.getInt("recipeTimeout") - String recipeParamXsd = resourceRecipe.get("paramXSD") - HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) - } else { - String exceptionMessage = "Resource receipe is not found for resource modeluuid: " + + if (resourceRecipe != null) { + String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + resourceRecipe.getString("orchestrationUri") + int recipeTimeOut = resourceRecipe.getInt("recipeTimeout") + String recipeParamXsd = resourceRecipe.get("paramXSD") + HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) + } else { + String exceptionMessage = "Resource receipe is not found for resource modeluuid: " + resourceInput.getResourceModelInfo().getModelUuid() - msoLogger.trace(exceptionMessage) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, exceptionMessage) - } + msoLogger.trace(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, exceptionMessage) + } - msoLogger.trace("======== end executeResourceRecipe Process ======== ") + msoLogger.trace("======== end executeResourceRecipe Process ======== ") }catch(BpmnError b){ msoLogger.debug("Rethrowing MSOWorkflowException") throw b @@ -273,7 +278,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured during DoCreateResources executeResourceRecipe Catalog") } } - + public void postConfigRequest(DelegateExecution execution){ //now do noting } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index 76dba27890..66bd1ece90 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -28,13 +28,15 @@ import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray -import org.json.JSONObject; +import org.json.JSONObject +import org.onap.so.bpmn.common.scripts.AaiUtil 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.core.WorkflowException import org.onap.so.bpmn.core.domain.Resource -import org.onap.so.bpmn.core.domain.ServiceDecomposition; +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.rest.APIResponse import org.onap.so.bpmn.core.json.JsonUtils import org.springframework.web.util.UriUtils; import org.w3c.dom.Document @@ -314,9 +316,9 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { JSONObject jObj = new JSONObject() def relation = utils.nodeToString(node) - def rt = utils.getNodeText1(relation, "related-to") + def rt = utils.getNodeText(relation, "related-to") - def rl = utils.getNodeText1(relation, "related-link") + def rl = utils.getNodeText(relation, "related-link") utils.log("INFO", "ServiceInstance Related NS/Configuration :" + rl, isDebugEnabled) def rl_datas = utils.getIdenticalChildren(node, "relationship-data") @@ -331,16 +333,13 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { jObj.put("resourceInstanceId", eValue) } // for sp-partner and others - else if(eKey.equals(rt + ".id")){ - jObj.put("resourceInstanceId", eValue) - String resourceName = rt + eValue; - jObj.put("resourceType", resourceName) - } - else if(eKey.equals(rt + ".id")){ + else if(eKey.endsWith("-id")){ jObj.put("resourceInstanceId", eValue) String resourceName = rt + eValue; jObj.put("resourceType", resourceName) } + + jObj.put("resourceLinkUrl", rl) } def rl_props = utils.getIdenticalChildren(node, "related-to-property") @@ -398,6 +397,71 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } } + private void generateRelatedResourceInfo(String response, JSONObject jObj){ + + def xml = new XmlSlurper().parseText(response) + def rtn = xml.childNodes() + while (rtn.hasNext()) { + groovy.util.slurpersupport.Node node = rtn.next() + def key = node.name() + def value = node.text() + jObj.put(key, value) + } + } + + private JSONObject getRelatedResourceInAAI (DelegateExecution execution, JSONObject jObj) + { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started getRelatedResourceInAAI *****", isDebugEnabled) + + AaiUtil aaiUriUtil = new AaiUtil() + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String urlLink = jObj.get("resourceLinkUrl") + String serviceAaiPath = "${aai_endpoint}${urlLink}" + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceAaiPath) + int responseCode = response.getStatusCode() + execution.setVariable(Prefix + "GeRelatedResourceResponseCode", responseCode) + utils.log("DEBUG", " Get RelatedResource code is: " + responseCode, isDebugEnabled) + + String aaiResponse = response.getResponseBodyAsString() + aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) + aaiResponse = aaiResponse.replaceAll("&", "&") + execution.setVariable(Prefix + "GetRelatedResourceResponse", aaiResponse) + + //Process Response + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + //200 OK 201 CREATED 202 ACCEPTED + { + utils.log("DEBUG", "GET RelatedResource Received a Good Response", isDebugEnabled) + execution.setVariable(Prefix + "SuccessIndicator", true) + execution.setVariable(Prefix + "FoundIndicator", true) + + generateRelatedResourceInfo(aaiResponse, jObj) + + //get model-invariant-uuid and model-uuid + String modelInvariantId = "" + String modelUuid = "" + String modelCustomizationId = "" + if(jObj.has("model-invariant-id")) { + modelInvariantId = jObj.get("model-invariant-id") + modelUuid = jObj.get("model-version-id") + modelCustomizationId = jObj.get("model-customization-id") + } + + jObj.put("modelInvariantId", modelInvariantId) + jObj.put("modelVersionId", modelUuid) + jObj.put("modelCustomizationId", modelCustomizationId) + } + else + { + utils.log("ERROR", "Get RelatedResource Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled) + } + + utils.log("INFO", " ***** Exit getRelatedResourceInAAI *****", isDebugEnabled) + return jObj; + + } + public void postDecomposeService(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") @@ -417,27 +481,38 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { if (serviceRelationShip != null) { relationShipList = jsonSlurper.parseText(serviceRelationShip) } - - List<Resource> deleteRealResourceList = new ArrayList<Resource>(); + + List<Resource> deleteRealResourceList = new ArrayList<Resource>() //Set the real resource instance id to the decomosed resource list - for (Resource resource: deleteResourceList) { - //reset the resource instance id , because in the decompose flow ,its a random one. - resource.setResourceId(""); - //match the resource-instance-name and the model name - if (relationShipList != null) { - relationShipList.each { - if (StringUtils.containsIgnoreCase(it.resourceType, resource.getModelInfo().getModelName())) { - resource.setResourceId(it.resourceInstanceId) + //reset the resource instance id , because in the decompose flow ,its a random one. + //match the resource-instance-name and the model name + if (relationShipList != null) { + relationShipList.each { + + JSONObject obj = getRelatedResourceInAAI(execution, (JSONObject)it) + + for (Resource resource : deleteResourceList) { + + String modelName = resource.getModelInfo().getModelName() + + String modelCustomizationUuid = resource.getModelInfo().getModelCustomizationUuid() + if (StringUtils.containsIgnoreCase(obj.get("resourceType"), modelName)) { + resource.setResourceId(obj.get("resourceInstanceId")) + deleteRealResourceList.add(resource) + } + else if (modelCustomizationUuid.equals(obj.get("modelCustomizationId"))) { + resource.setResourceId(obj.get("resourceInstanceId")) + resource.setResourceInstanceName(obj.get("resourceType")) deleteRealResourceList.add(resource) } } } - } - + } + // only delete real existing resources execution.setVariable("deleteResourceList", deleteRealResourceList) - + utils.log("DEBUG", "delete resource list : " + deleteRealResourceList, isDebugEnabled) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. processDecomposition() - " + ex.getMessage() diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy index a5a96f3bd3..cf0bd3f6fe 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy @@ -150,8 +150,11 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { // get delete resource list and order list List<Resource> delResourceList = execution.getVariable("deleteResourceList") + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + String serviceModelName = serviceDecomposition.getModelInfo().getModelName(); - def resourceSequence = BPMNProperties.getResourceSequenceProp() + def resourceSequence = BPMNProperties.getResourceSequenceProp(serviceModelName) if(resourceSequence != null) { for (resourceType in resourceSequence.reverse()) { @@ -186,6 +189,11 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { } String isContainsWanResource = wanResources.isEmpty() ? "false" : "true" + //if no networkResource, get SDNC config from properties file + if( "false".equals(isContainsWanResource)) { + String serviceNeedSDNC = "mso.workflow.custom." + serviceModelName + ".sdnc.need"; + isContainsWanResource = BPMNProperties.getProperty(serviceNeedSDNC, isContainsWanResource) + } execution.setVariable("isContainsWanResource", isContainsWanResource) execution.setVariable("currentResourceIndex", 0) execution.setVariable("sequencedResourceList", sequencedResourceList) @@ -244,7 +252,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { resourceInput.setResourceInstanceName(currentResource.getResourceInstanceName()) resourceInput.setResourceInstancenUuid(currentResource.getResourceId()) resourceInput.setOperationId(execution.getVariable("operationId")) - resourceInput.setOperationType(execution.getVariable("operationType")) + resourceInput.setOperationType(execution.getVariable("operationType")) String globalSubscriberId = execution.getVariable("globalSubscriberId") resourceInput.setGlobalSubscriberId(globalSubscriberId) resourceInput.setResourceModelInfo(currentResource.getModelInfo()); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy index 86c5f65e8c..dd135f3af5 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy @@ -232,6 +232,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { } if ("Homing_Solution".equals(userParam?.name)) { execution.setVariable("homingService", userParam.value) + execution.setVariable("callHoming", true) inputMap.put("Homing_Solution", userParam.value) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java index 63463096d7..5fe28b918b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.workflow.service; import java.io.IOException; +import java.io.UnsupportedEncodingException; import java.net.SocketTimeoutException; import java.util.ArrayList; import java.util.HashMap; @@ -54,6 +55,7 @@ import org.onap.so.bpmn.common.scripts.AaiUtil; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import org.springframework.web.util.UriUtils; public class ServicePluginFactory { @@ -79,6 +81,10 @@ public class ServicePluginFactory { } return instance; } + + private ServicePluginFactory() { + + } private String getInventoryOSSEndPoint(){ return UrnPropertiesReader.getVariable("mso.service-plugin.inventory-oss-endpoint", INVENTORY_OSS_DEFAULT_ENDPOINT); @@ -110,13 +116,18 @@ public class ServicePluginFactory { return newRequest; } - List<Resource> addResourceList = serviceDecomposition.getServiceResources(); + List<Resource> addResourceList = new ArrayList<Resource>(); + addResourceList.addAll(serviceDecomposition.getServiceResources()); + + serviceDecomposition.setVnfResources(null); + serviceDecomposition.setAllottedResources(null); + serviceDecomposition.setNetworkResources(null); + serviceDecomposition.setConfigResources(null); for (Resource resource : addResourceList) { String resourcemodelName = resource.getModelInfo().getModelName(); - if (!StringUtils.containsIgnoreCase(resourcemodelName, "sp-partner") - || !StringUtils.containsIgnoreCase(resourcemodelName, "sppartner")) { + if (StringUtils.containsIgnoreCase(resourcemodelName, "sppartner")) { // change serviceDecomposition - serviceDecomposition.deleteResource(resource); + serviceDecomposition.addResource(resource); break; } } @@ -149,7 +160,7 @@ public class ServicePluginFactory { accessTPInfo.put("access-ltp-id", tpInfoMap.get("access-ltp-id")); // change resources - String resourceName = (String) accessTPInfo.get("resourceName"); + String resourceName = (String) tpInfoMap.get("resourceName"); for(Object curResource : resources) { Map<String, Object> resource = (Map<String, Object>)curResource; String curResourceName = (String) resource.get("resourceName"); @@ -165,9 +176,9 @@ public class ServicePluginFactory { @SuppressWarnings("unchecked") private Map<String, Object> getTPforVPNAttachment(Map<String, Object> serviceRequestInputs) { - Object location = ""; - Object clientSignal = ""; - String vpnAttachmentResourceName = ""; + Object location = null; + Object clientSignal = null; + String vpnAttachmentResourceName = null; // support R2 uuiReq and R1 uuiReq // logic for R2 uuiRequest params in service level @@ -185,7 +196,7 @@ public class ServicePluginFactory { Map<String, Object> tpInfoMap = new HashMap<String, Object>(); // Site resource has location param and SOTNAttachment resource has clientSignal param - if("".equals(location) || "".equals(clientSignal) ) { + if(location == null || clientSignal == null ) { return tpInfoMap; } @@ -193,9 +204,16 @@ public class ServicePluginFactory { String locationAddress = (String) location; List<Object> locationTPList = queryAccessTPbyLocationFromInventoryOSS(locationAddress); if(locationTPList != null && !locationTPList.isEmpty()) { - tpInfoMap = (Map<String, Object>) locationTPList.get(0); - // add resourceName - tpInfoMap.put("resourceName", vpnAttachmentResourceName); + for(Object tp: locationTPList) { + Map<String, Object> tpJson = (Map<String, Object>) tp; + String loc = (String)tpJson.get ("location"); + if(StringUtils.equalsIgnoreCase (locationAddress, loc)) { + tpInfoMap = tpJson; + // add resourceName + tpInfoMap.put("resourceName", vpnAttachmentResourceName); + break; + } + } LOGGER.debug("Get Terminal TP from InventoryOSS"); return tpInfoMap; } @@ -205,11 +223,14 @@ public class ServicePluginFactory { @SuppressWarnings("unchecked") private List<Object> queryAccessTPbyLocationFromInventoryOSS(String locationAddress) { - Map<String, String> locationSrc = new HashMap<String, String>(); - locationSrc.put("location", locationAddress); - String reqContent = getJsonString(locationSrc); String url = getInventoryOSSEndPoint(); - String responseContent = sendRequest(url, "POST", reqContent); + try { + url += "/oss/inventory?location=" + UriUtils.encode(locationAddress,"UTF-8"); + } catch (UnsupportedEncodingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + String responseContent = sendRequest(url, "GET", ""); List<Object> accessTPs = new ArrayList<Object>(); if (null != responseContent) { accessTPs = getJsonObject(responseContent, List.class); @@ -227,8 +248,14 @@ public class ServicePluginFactory { if(resource.containsKey("parameters")) { Map<String, Object> resParametersObject = (Map<String, Object>) resource.get("parameters"); if(resParametersObject.containsKey("requestInputs")) { - Map<String, Object> resRequestInputs = (Map<String, Object>) resourceParametersObject.get("requestInputs"); - resRequestInputs.putAll(resourceInputs); + Map<String, Object> resRequestInputs = (Map<String, Object>) resourceRequestInputs.get("requestInputs"); + Map<String, Object> oldRequestInputs = (Map<String, Object>) resParametersObject.get("requestInputs"); + if(oldRequestInputs != null) { + oldRequestInputs.putAll(resRequestInputs); + } + else { + resParametersObject.put("requestInputs", resRequestInputs); + } } else { resParametersObject.putAll(resourceRequestInputs); @@ -267,14 +294,20 @@ public class ServicePluginFactory { if("ExternalAPI".equalsIgnoreCase(callSource)) { return false; } - } - return true; + } + for (String input : serviceRequestInputs.keySet()) + { + if(input.toLowerCase().contains("sotnconnectivity")) { + return true; + } + } + return false; } @SuppressWarnings("unchecked") private void allocateCrossTPResources(DelegateExecution execution, Map<String, Object> serviceRequestInputs) { - AaiUtil aai = new AaiUtil(null); + AaiUtil aai = new AaiUtil(); Map<String, Object> crossTPs = aai.getTPsfromAAI(execution); if(crossTPs == null || crossTPs.isEmpty()) { @@ -384,8 +417,11 @@ public class ServicePluginFactory { Map<String, Object> vpnRequestInputs = getVPNResourceRequestInputs(resources); // here we put client signal to vpn resource inputs - vpnRequestInputs.put("src-client-signal", srcClientSignal); - vpnRequestInputs.put("dst-client-signal", dstClientSignal); + if(null!=vpnRequestInputs) { + vpnRequestInputs.put("src-client-signal", srcClientSignal); + vpnRequestInputs.put("dst-client-signal", dstClientSignal); + } + // Now we need to query terminal points from SP resourcemgr system. List<Object> locationTerminalPointList = queryTerminalPointsFromServiceProviderSystem(srcLocation, dstLocation); @@ -581,6 +617,8 @@ public class ServicePluginFactory { } else if ("GET".equals(methodType.toUpperCase())) { HttpGet httpGet = new HttpGet(msbUrl); httpGet.setConfig(requestConfig); + httpGet.addHeader("X-FromAppId", "MSO"); + httpGet.addHeader("Accept","application/json"); method = httpGet; } else if ("DELETE".equals(methodType.toUpperCase())) { HttpDelete httpDelete = new HttpDelete(msbUrl); diff --git a/bpmn/so-bpmn-infrastructure-flows/pom.xml b/bpmn/so-bpmn-infrastructure-flows/pom.xml index 4db7b3ff66..63b66cafe5 100644 --- a/bpmn/so-bpmn-infrastructure-flows/pom.xml +++ b/bpmn/so-bpmn-infrastructure-flows/pom.xml @@ -168,11 +168,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - - </dependency> - <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <version>1.10.19</version> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn index 6b3641b235..e3b5e7997e 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn @@ -1,51 +1,36 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.16.2"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.0"> <bpmn:process id="ActivateSDNCNetworkResource" name="ActivateSDNCNetworkResource" isExecutable="true"> - <bpmn:startEvent id="createNS_StartEvent" name="createNS_StartEvent"> - <bpmn:outgoing>SequenceFlow_1c92ks3</bpmn:outgoing> + <bpmn:startEvent id="createNS_StartEvent_activate" name="createNS_StartEvent"> + <bpmn:outgoing>SequenceFlow_1c92ks3_activate</bpmn:outgoing> </bpmn:startEvent> - <bpmn:endEvent id="EndEvent_1x6k78c" name="create SDNC call end"> - <bpmn:incoming>SequenceFlow_17md60u</bpmn:incoming> + <bpmn:endEvent id="EndEvent_1x6k78c_activate" name="create SDNC call end"> + <bpmn:incoming>SequenceFlow_17md60u_activate</bpmn:incoming> </bpmn:endEvent> - <bpmn:callActivity id="CallActivity_1600xlj" name="Call SDNC resource activate Adapter V1 " calledElement="sdncAdapter"> - <bpmn:extensionElements> - <camunda:in source="CRESDNCRES_activateSDNCRequest" target="sdncAdapterWorkflowRequest" /> - <camunda:in source="mso-request-id" target="mso-request-id" /> - <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> - <camunda:out source="sdncAdapterResponse" target="CRENWKI_activateSDNCResponse" /> - <camunda:out source="SDNCA_ResponseCode" target="CRESDNCRES_sdncCreateReturnCode" /> - <camunda:out source="SDNCA_SuccessIndicator" target="CRESDNCRES_SuccessIndicator" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0sjrnv5</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1xk5xed</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_1xk5xed" sourceRef="CallActivity_1600xlj" targetRef="Task_0uwlr22" /> - <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred" targetRef="ScriptTask_1g5zyi6" /> - <bpmn:scriptTask id="Task_023hred" name="post SDNC activate call"> - <bpmn:incoming>SequenceFlow_1vnx1pp</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0ow44q0</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_0ow44q0_activate" sourceRef="Task_023hred_activate" targetRef="ScriptTask_1g5zyi6_activate" /> + <bpmn:scriptTask id="Task_023hred_activate" name="post SDNC activate call"> + <bpmn:incoming>SequenceFlow_1vnx1pp_activate</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ow44q0_activate</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new ActivateSDNCNetworkResource() -dcsi.postCreateSDNCCall(execution)</bpmn:script> +dcsi.postActivateSDNCCall(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_18l3crb" sourceRef="Task_13sx2bp" targetRef="ScriptTask_1gih50a" /> - <bpmn:scriptTask id="Task_13sx2bp" name="Pre Process Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1c92ks3</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_18l3crb</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_18l3crb_activate" sourceRef="Task_13sx2bp_activate" targetRef="ScriptTask_1gih50a_activate" /> + <bpmn:scriptTask id="Task_13sx2bp_activate" name="Pre Process Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1c92ks3_activate</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18l3crb_activate</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new ActivateSDNCNetworkResource() dcsi.preProcessRequest(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="Task_0uwlr22" name="Create progress update parameters After create" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1xk5xed</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1jr6zi0</bpmn:outgoing> + <bpmn:scriptTask id="Task_0uwlr22_activate" name="Create progress update parameters After create" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_13ee4rf</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1jr6zi0_activate</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new ActivateSDNCNetworkResource() dcsi.prepareUpdateAfterActivateSDNCResource(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:serviceTask id="ServiceTask_1cm8iwr" name="update progress update"> + <bpmn:serviceTask id="ServiceTask_1cm8iwr_activate" name="update progress update"> <bpmn:extensionElements> <camunda:connector> <camunda:inputOutput> @@ -64,114 +49,126 @@ dcsi.prepareUpdateAfterActivateSDNCResource(execution)</bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1jr6zi0</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1vnx1pp</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_1jr6zi0_activate</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1vnx1pp_activate</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_1jr6zi0" sourceRef="Task_0uwlr22" targetRef="ServiceTask_1cm8iwr" /> - <bpmn:sequenceFlow id="SequenceFlow_1vnx1pp" sourceRef="ServiceTask_1cm8iwr" targetRef="Task_023hred" /> - <bpmn:scriptTask id="ScriptTask_1g5zyi6" name="Send Sync Ack Response" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_17md60u</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_1jr6zi0_activate" sourceRef="Task_0uwlr22_activate" targetRef="ServiceTask_1cm8iwr_activate" /> + <bpmn:sequenceFlow id="SequenceFlow_1vnx1pp_activate" sourceRef="ServiceTask_1cm8iwr_activate" targetRef="Task_023hred_activate" /> + <bpmn:scriptTask id="ScriptTask_1g5zyi6_activate" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ow44q0_activate</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_17md60u_activate</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi = new ActivateSDNCNetworkResource() csi.sendSyncResponse(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_17md60u" sourceRef="ScriptTask_1g5zyi6" targetRef="EndEvent_1x6k78c" /> - <bpmn:sequenceFlow id="SequenceFlow_1c92ks3" sourceRef="createNS_StartEvent" targetRef="Task_13sx2bp" /> - <bpmn:scriptTask id="ScriptTask_1gih50a" name="Prepare SDNC Actiate request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_18l3crb</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0sjrnv5</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* + <bpmn:sequenceFlow id="SequenceFlow_17md60u_activate" sourceRef="ScriptTask_1g5zyi6_activate" targetRef="EndEvent_1x6k78c_activate" /> + <bpmn:sequenceFlow id="SequenceFlow_1c92ks3_activate" sourceRef="createNS_StartEvent_activate" targetRef="Task_13sx2bp_activate" /> + <bpmn:scriptTask id="ScriptTask_1gih50a_activate" name="Prepare SDNC Actiate request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_18l3crb_activate</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0sjrnv5_activate</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new ActivateSDNCNetworkResource() dcsi.prepareSDNCRequest(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_0sjrnv5" sourceRef="ScriptTask_1gih50a" targetRef="CallActivity_1600xlj" /> + <bpmn:sequenceFlow id="SequenceFlow_0sjrnv5_activate" sourceRef="ScriptTask_1gih50a_activate" targetRef="CallActivity_1241bmd_activate" /> + <bpmn:callActivity id="CallActivity_1241bmd_activate" name="Call SDNC RSRC Adapter V1 " calledElement="sdncAdapter"> + <bpmn:extensionElements> + <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="sdncAdapterResponse" target="DELSDNCRES_activateSDNCResponse" /> + <camunda:out source="SDNCA_ResponseCode" target="DELSDNCRES_sdncDeleteReturnCode" /> + <camunda:out source="SDNCA_SuccessIndicator" target="DELSDNCRES_SuccessIndicator" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0sjrnv5_activate</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_13ee4rf</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_13ee4rf" sourceRef="CallActivity_1241bmd_activate" targetRef="Task_0uwlr22_activate" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateSDNCNetworkResource"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createNS_StartEvent"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createNS_StartEvent_activate"> <dc:Bounds x="-275" y="306" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-302" y="352" width="89" height="27" /> + <dc:Bounds x="-299" y="352" width="84" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> + <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c_activate"> <dc:Bounds x="930" y="306" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="893" y="348" width="84" height="27" /> + <dc:Bounds x="893" y="348" width="85" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_1600xlj_di" bpmnElement="CallActivity_1600xlj"> - <dc:Bounds x="77" y="284" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1xk5xed_di" bpmnElement="SequenceFlow_1xk5xed"> - <di:waypoint x="177" y="324" /> - <di:waypoint x="247" y="324" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="210.5" y="314" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0"> + <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0_activate"> <di:waypoint x="694" y="324" /> <di:waypoint x="765" y="324" /> <bpmndi:BPMNLabel> <dc:Bounds x="780.5" y="314" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred"> + <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred_activate"> <dc:Bounds x="594" y="284" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb"> + <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb_activate"> <di:waypoint x="-105" y="324" /> <di:waypoint x="-63" y="324" /> <bpmndi:BPMNLabel> <dc:Bounds x="235.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp"> + <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp_activate"> <dc:Bounds x="-205" y="284" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0hu4lhm_di" bpmnElement="Task_0uwlr22"> - <dc:Bounds x="247" y="284" width="100" height="80" /> + <bpmndi:BPMNShape id="ScriptTask_0hu4lhm_di" bpmnElement="Task_0uwlr22_activate"> + <dc:Bounds x="246" y="284" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1cm8iwr_di" bpmnElement="ServiceTask_1cm8iwr"> + <bpmndi:BPMNShape id="ServiceTask_1cm8iwr_di" bpmnElement="ServiceTask_1cm8iwr_activate"> <dc:Bounds x="417" y="284" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1jr6zi0_di" bpmnElement="SequenceFlow_1jr6zi0"> - <di:waypoint x="347" y="324" /> + <bpmndi:BPMNEdge id="SequenceFlow_1jr6zi0_di" bpmnElement="SequenceFlow_1jr6zi0_activate"> + <di:waypoint x="346" y="324" /> <di:waypoint x="417" y="324" /> <bpmndi:BPMNLabel> <dc:Bounds x="444.5" y="314" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1vnx1pp_di" bpmnElement="SequenceFlow_1vnx1pp"> + <bpmndi:BPMNEdge id="SequenceFlow_1vnx1pp_di" bpmnElement="SequenceFlow_1vnx1pp_activate"> <di:waypoint x="517" y="324" /> <di:waypoint x="594" y="324" /> <bpmndi:BPMNLabel> <dc:Bounds x="641" y="314" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1g5zyi6_di" bpmnElement="ScriptTask_1g5zyi6"> + <bpmndi:BPMNShape id="ScriptTask_1g5zyi6_di" bpmnElement="ScriptTask_1g5zyi6_activate"> <dc:Bounds x="765" y="284" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_17md60u_di" bpmnElement="SequenceFlow_17md60u"> + <bpmndi:BPMNEdge id="SequenceFlow_17md60u_di" bpmnElement="SequenceFlow_17md60u_activate"> <di:waypoint x="865" y="324" /> <di:waypoint x="930" y="324" /> <bpmndi:BPMNLabel> <dc:Bounds x="998" y="313" width="0" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1c92ks3_di" bpmnElement="SequenceFlow_1c92ks3"> + <bpmndi:BPMNEdge id="SequenceFlow_1c92ks3_di" bpmnElement="SequenceFlow_1c92ks3_activate"> <di:waypoint x="-239" y="324" /> <di:waypoint x="-205" y="324" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1gih50a_di" bpmnElement="ScriptTask_1gih50a"> + <bpmndi:BPMNShape id="ScriptTask_1gih50a_di" bpmnElement="ScriptTask_1gih50a_activate"> <dc:Bounds x="-63" y="284" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0sjrnv5_di" bpmnElement="SequenceFlow_0sjrnv5"> + <bpmndi:BPMNEdge id="SequenceFlow_0sjrnv5_di" bpmnElement="SequenceFlow_0sjrnv5_activate"> <di:waypoint x="37" y="324" /> - <di:waypoint x="77" y="324" /> + <di:waypoint x="80" y="324" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1241bmd_di" bpmnElement="CallActivity_1241bmd_activate"> + <dc:Bounds x="80" y="284" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_13ee4rf_di" bpmnElement="SequenceFlow_13ee4rf"> + <di:waypoint x="180" y="324" /> + <di:waypoint x="246" y="324" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions> +</bpmn:definitions>
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn index 21f18e9fa2..6a7cf8160a 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn @@ -14,7 +14,7 @@ dcsi.prepare3rdONAPRequest(execution)]]></bpmn:script> <bpmn:endEvent id="EndEvent_013449q" name="Create3rdONAPRES_End"> <bpmn:incoming>SequenceFlow_0a8k9xi</bpmn:incoming> </bpmn:endEvent> - <bpmn:scriptTask id="ScriptTask_1b88nnk" name="Save SPPartner In AAI"> + <bpmn:scriptTask id="ScriptTask_1b88nnk" name="Save SPPartner In AAI" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0y2g8mr</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0znwu8z</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* @@ -93,7 +93,7 @@ dcsi.doCreateE2ESIin3rdONAP(execution)]]></bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0fkfn70</bpmn:incoming> + <bpmn:incoming>SequenceFlow_03ouq4m</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1luhljs</bpmn:outgoing> </bpmn:serviceTask> <bpmn:scriptTask id="ScriptTask_03xvdc8" name="Allocate connection resources for cross ONAP" scriptFormat="groovy"> @@ -167,7 +167,7 @@ dcsi.checkLocallCall(execution)]]></bpmn:script> <bpmn:endEvent id="EndEvent_0o0n3fa" name="Create3rdONAPRES_End"> <bpmn:incoming>SequenceFlow_131f1jj</bpmn:incoming> </bpmn:endEvent> - <bpmn:scriptTask id="ScriptTask_1lazb8l" name="Save SPPartner In AAI"> + <bpmn:scriptTask id="ScriptTask_1lazb8l" name="Save SPPartner In AAI" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1wq9f5k</bpmn:incoming> <bpmn:outgoing>SequenceFlow_18gb81f</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* @@ -191,7 +191,7 @@ execution.setVariable("statusDescription", "Local Creation Only") def dcsi = new Create3rdONAPE2EServiceInstance() dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:serviceTask id="ServiceTask_1kgvq5e" name="update progress update"> + <bpmn:serviceTask id="ServiceTask_1kgvq5e" name="resource progress update"> <bpmn:extensionElements> <camunda:connector> <camunda:inputOutput> @@ -276,9 +276,9 @@ csi.sendSyncResponse(execution)]]></bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_15mvx68" sourceRef="ScriptTask_0rs5t7w" targetRef="ScriptTask_0r2cxvb" /> <bpmn:sequenceFlow id="SequenceFlow_0wp73cw" sourceRef="ScriptTask_0r2cxvb" targetRef="ExclusiveGateway_1662gjm" /> <bpmn:sequenceFlow id="SequenceFlow_13s0mg5" name="yes" sourceRef="ExclusiveGateway_1662gjm" targetRef="ScriptTask_0yz8d8c"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("serviceOrderId" ) != null && execution.getVariable("serviceOrderId" ) != "" )}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("ServiceOrderId" ) != null && execution.getVariable("ServiceOrderId" ) != "" )}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_0fkfn70" sourceRef="ScriptTask_0yz8d8c" targetRef="ServiceTask_0p5029r" /> + <bpmn:sequenceFlow id="SequenceFlow_0fkfn70" sourceRef="ScriptTask_0yz8d8c" targetRef="ScriptTask_0lffwny" /> <bpmn:sequenceFlow id="SequenceFlow_1suwdgi" sourceRef="ServiceTask_039ju3f" targetRef="ScriptTask_03xvdc8" /> <bpmn:sequenceFlow id="SequenceFlow_0kkou66" sourceRef="ScriptTask_1pdhttw" targetRef="ScriptTask_0yz8d8c" /> <bpmn:sequenceFlow id="SequenceFlow_1luhljs" sourceRef="ServiceTask_0p5029r" targetRef="ExclusiveGateway_1we7izu" /> @@ -327,6 +327,14 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0i9iiuo" sourceRef="ScriptTask_07cq0pw" targetRef="ServiceTask_1ixmamy" /> <bpmn:sequenceFlow id="SequenceFlow_1mei7hu" sourceRef="ServiceTask_1ixmamy" targetRef="EndEvent_19joonf" /> + <bpmn:scriptTask id="ScriptTask_0lffwny" name="update resource progress" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0fkfn70</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_03ouq4m</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new Create3rdONAPE2EServiceInstance() +dcsi.prepareUpdateProgress(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_03ouq4m" sourceRef="ScriptTask_0lffwny" targetRef="ServiceTask_0p5029r" /> </bpmn:process> <bpmn:error id="Error_0nbdy47" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -365,7 +373,7 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> <dc:Bounds x="163" y="12" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0p5029r_di" bpmnElement="ServiceTask_0p5029r"> - <dc:Bounds x="798" y="12" width="100" height="80" /> + <dc:Bounds x="798" y="129" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_03xvdc8_di" bpmnElement="ScriptTask_03xvdc8"> <dc:Bounds x="798" y="-153" width="100" height="80" /> @@ -600,7 +608,7 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1pdhttw_di" bpmnElement="ScriptTask_1pdhttw"> - <dc:Bounds x="573" y="187" width="100" height="80" /> + <dc:Bounds x="573" y="220" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1662gjm_di" bpmnElement="ExclusiveGateway_1662gjm" isMarkerVisible="true"> <dc:Bounds x="386" y="27" width="50" height="50" /> @@ -609,9 +617,9 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1we7izu_di" bpmnElement="ExclusiveGateway_1we7izu" isMarkerVisible="true"> - <dc:Bounds x="823" y="202" width="50" height="50" /> + <dc:Bounds x="823" y="235" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="880" y="206" width="68" height="42" /> + <dc:Bounds x="878" y="239" width="72" height="36" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_18auy29_di" bpmnElement="ScriptTask_18auy29"> @@ -649,9 +657,11 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0fkfn70_di" bpmnElement="SequenceFlow_0fkfn70"> <di:waypoint xsi:type="dc:Point" x="673" y="52" /> + <di:waypoint xsi:type="dc:Point" x="736" y="52" /> + <di:waypoint xsi:type="dc:Point" x="736" y="52" /> <di:waypoint xsi:type="dc:Point" x="798" y="52" /> <bpmndi:BPMNLabel> - <dc:Bounds x="690.5" y="30" width="90" height="14" /> + <dc:Bounds x="706" y="45" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1suwdgi_di" bpmnElement="SequenceFlow_1suwdgi"> @@ -662,24 +672,24 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0kkou66_di" bpmnElement="SequenceFlow_0kkou66"> - <di:waypoint xsi:type="dc:Point" x="623" y="187" /> + <di:waypoint xsi:type="dc:Point" x="623" y="220" /> <di:waypoint xsi:type="dc:Point" x="623" y="92" /> <bpmndi:BPMNLabel> - <dc:Bounds x="593" y="132.5" width="90" height="14" /> + <dc:Bounds x="593" y="149" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1luhljs_di" bpmnElement="SequenceFlow_1luhljs"> - <di:waypoint xsi:type="dc:Point" x="848" y="92" /> - <di:waypoint xsi:type="dc:Point" x="848" y="202" /> + <di:waypoint xsi:type="dc:Point" x="848" y="209" /> + <di:waypoint xsi:type="dc:Point" x="848" y="235" /> <bpmndi:BPMNLabel> - <dc:Bounds x="818" y="140" width="90" height="14" /> + <dc:Bounds x="818" y="215" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1udji9x_di" bpmnElement="SequenceFlow_1udji9x"> - <di:waypoint xsi:type="dc:Point" x="823" y="227" /> - <di:waypoint xsi:type="dc:Point" x="673" y="227" /> + <di:waypoint xsi:type="dc:Point" x="823" y="260" /> + <di:waypoint xsi:type="dc:Point" x="673" y="260" /> <bpmndi:BPMNLabel> - <dc:Bounds x="746" y="208" width="12" height="14" /> + <dc:Bounds x="746" y="241" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_19joonf_di" bpmnElement="EndEvent_19joonf"> @@ -698,12 +708,12 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0y2g8mr_di" bpmnElement="SequenceFlow_0y2g8mr"> - <di:waypoint xsi:type="dc:Point" x="848" y="252" /> + <di:waypoint xsi:type="dc:Point" x="848" y="285" /> <di:waypoint xsi:type="dc:Point" x="848" y="324" /> <di:waypoint xsi:type="dc:Point" x="9" y="324" /> <di:waypoint xsi:type="dc:Point" x="9" y="371" /> <bpmndi:BPMNLabel> - <dc:Bounds x="419.8991436726927" y="302" width="18" height="14" /> + <dc:Bounds x="419" y="302" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0mmu3kz_di" bpmnElement="SequenceFlow_0mmu3kz"> @@ -735,6 +745,16 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> <dc:Bounds x="326.5" y="193" width="0" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0lffwny_di" bpmnElement="ScriptTask_0lffwny"> + <dc:Bounds x="798" y="12" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_03ouq4m_di" bpmnElement="SequenceFlow_03ouq4m"> + <di:waypoint xsi:type="dc:Point" x="848" y="92" /> + <di:waypoint xsi:type="dc:Point" x="848" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="863" y="104.5" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn index 3e2c316ffc..3c7be0937f 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3"> - <bpmn:process id="CreateDeviceResource.bpmn" name="CreateDeviceResource.bpmn" isExecutable="true"> + <bpmn:process id="CreateDeviceResource" name="CreateDeviceResource" isExecutable="true"> <bpmn:endEvent id="EndEvent_1x6k78c" name="create Dev end"> <bpmn:incoming>SequenceFlow_0auvfvm</bpmn:incoming> </bpmn:endEvent> @@ -8,7 +8,7 @@ <bpmn:incoming>SequenceFlow_05niqbf</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0auvfvm</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def csi = new CreateDeviceResource.bpmn() +def csi = new CreateDeviceResource() csi.sendSyncResponse(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_05niqbf" sourceRef="Task_0bga3e8" targetRef="ScriptTask_1g5zyi6" /> @@ -43,11 +43,11 @@ csi.sendSyncResponse(execution)]]></bpmn:script> def dcsi = new CreateDeviceResource() dcsi.checkDevType(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_0kba700" name="Dev Type" default="SequenceFlow_076ma0v"> + <bpmn:exclusiveGateway id="ExclusiveGateway_0kba700" name="Dev Type" default="SequenceFlow_0b5nrig"> <bpmn:incoming>SequenceFlow_1hp2h5t</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1ss02ik</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_0h4378g</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_076ma0v</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0b5nrig</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1chnlq6" name="GoTo StartCreateDevinSDNC"> <bpmn:incoming>SequenceFlow_0h4378g</bpmn:incoming> @@ -91,10 +91,6 @@ dcsi.preProcessRequest(execution)]]></bpmn:script> <bpmn:outgoing>SequenceFlow_0pkp4ce</bpmn:outgoing> </bpmn:callActivity> <bpmn:sequenceFlow id="SequenceFlow_0pkp4ce" sourceRef="CallActivity_0pyrfca" targetRef="ScriptTask_0u1piih" /> - <bpmn:endEvent id="EndEvent_0ymfq61"> - <bpmn:incoming>SequenceFlow_076ma0v</bpmn:incoming> - </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_076ma0v" sourceRef="ExclusiveGateway_0kba700" targetRef="EndEvent_0ymfq61" /> <bpmn:scriptTask id="ScriptTask_02rli65" name="Get VNF Template fom SDC" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1ss02ik</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0pg3072</bpmn:outgoing> @@ -111,9 +107,47 @@ def dcsi = new CreateDeviceResource() dcsi.postVNFInfoProcess(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_1ylvnxq" sourceRef="ScriptTask_0u1piih" targetRef="IntermediateThrowEvent_1caax8u" /> + <bpmn:scriptTask id="ScriptTask_0p4b5vu" name="Prepare Create resource progress" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0b5nrig</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_09s5dfc</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +execution.setVariable("progress", "100") +execution.setVariable("status", "finished") +execution.setVariable("statusDescription", "Finished for the devType") +def dcsi = new CreateDeviceResource() +dcsi.prepareUpdateProgress(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0b5nrig" sourceRef="ExclusiveGateway_0kba700" targetRef="ScriptTask_0p4b5vu" /> + <bpmn:serviceTask id="ServiceTask_08e6hpm" name="resource progress update"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_09s5dfc</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0kt3xbf</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_09s5dfc" sourceRef="ScriptTask_0p4b5vu" targetRef="ServiceTask_08e6hpm" /> + <bpmn:endEvent id="EndEvent_0ntv40y"> + <bpmn:incoming>SequenceFlow_0kt3xbf</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0kt3xbf" sourceRef="ServiceTask_08e6hpm" targetRef="EndEvent_0ntv40y" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateDeviceResource.bpmn"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateDeviceResource"> <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> <dc:Bounds x="1026" y="111" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -158,7 +192,7 @@ dcsi.postVNFInfoProcess(execution)]]></bpmn:script> <bpmndi:BPMNShape id="ExclusiveGateway_0kba700_di" bpmnElement="ExclusiveGateway_0kba700" isMarkerVisible="true"> <dc:Bounds x="334" y="-152" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="309" y="-166" width="34" height="12" /> + <dc:Bounds x="302" y="-166" width="48" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_1chnlq6_di" bpmnElement="IntermediateThrowEvent_1chnlq6"> @@ -228,19 +262,6 @@ dcsi.postVNFInfoProcess(execution)]]></bpmn:script> <dc:Bounds x="760.5" y="-148" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_0ymfq61_di" bpmnElement="EndEvent_0ymfq61"> - <dc:Bounds x="341" y="-251" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="359" y="-211" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_076ma0v_di" bpmnElement="SequenceFlow_076ma0v"> - <di:waypoint xsi:type="dc:Point" x="359" y="-152" /> - <di:waypoint xsi:type="dc:Point" x="359" y="-215" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="374" y="-189.5" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_02rli65_di" bpmnElement="ScriptTask_02rli65"> <dc:Bounds x="480" y="-167" width="100" height="80" /> </bpmndi:BPMNShape> @@ -261,6 +282,43 @@ dcsi.postVNFInfoProcess(execution)]]></bpmn:script> <dc:Bounds x="987.5" y="-148" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0p4b5vu_di" bpmnElement="ScriptTask_0p4b5vu"> + <dc:Bounds x="309" y="-290" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0b5nrig_di" bpmnElement="SequenceFlow_0b5nrig"> + <di:waypoint xsi:type="dc:Point" x="359" y="-152" /> + <di:waypoint xsi:type="dc:Point" x="359" y="-181" /> + <di:waypoint xsi:type="dc:Point" x="359" y="-181" /> + <di:waypoint xsi:type="dc:Point" x="359" y="-210" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="374" y="-187" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_08e6hpm_di" bpmnElement="ServiceTask_08e6hpm"> + <dc:Bounds x="530" y="-290" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_09s5dfc_di" bpmnElement="SequenceFlow_09s5dfc"> + <di:waypoint xsi:type="dc:Point" x="409" y="-250" /> + <di:waypoint xsi:type="dc:Point" x="477" y="-250" /> + <di:waypoint xsi:type="dc:Point" x="477" y="-250" /> + <di:waypoint xsi:type="dc:Point" x="530" y="-250" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="492" y="-256" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_0ntv40y_di" bpmnElement="EndEvent_0ntv40y"> + <dc:Bounds x="705" y="-268" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="723" y="-228" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0kt3xbf_di" bpmnElement="SequenceFlow_0kt3xbf"> + <di:waypoint xsi:type="dc:Point" x="630" y="-250" /> + <di:waypoint xsi:type="dc:Point" x="705" y="-250" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="667.5" y="-271" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn index 50e65dcaad..9e2049732a 100644..100755 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="CreateGenericALaCarteServiceInstance" name="CreateGenericALaCarteServiceInstance" isExecutable="true"> <bpmn2:startEvent id="createSI_startEvent" name="Create SI Start Flow"> <bpmn2:outgoing>SequenceFlow_0lp2z7l</bpmn2:outgoing> @@ -39,7 +39,7 @@ ex.processJavaException(execution)]]></bpmn2:script> <camunda:in source="serviceDecomposition" target="serviceDecomposition" /> <camunda:in source="bpmnRequest" target="requestJson" /> </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_1hjh5zy</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1fv5tk6</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1lj31zp</bpmn2:outgoing> </bpmn2:callActivity> <bpmn2:endEvent id="EndEvent_0o440av" name="End"> @@ -174,17 +174,62 @@ csi.prepareDecomposeService(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_1o3ihrh</bpmn2:outgoing> </bpmn2:callActivity> <bpmn2:scriptTask id="ScriptTask_04zaa1o" name="Prepare Create Service " scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1o3ihrh</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_14ajbme</bpmn2:outgoing> + <bpmn2:incoming>SequenceFlow_1hjh5zy</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1fv5tk6</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def csi= new CreateGenericALaCarteServiceInstance() csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_0xhu1k3" sourceRef="ScriptTask_1vr3ks5" targetRef="CallActivity_1oc1h9q" /> - <bpmn2:sequenceFlow id="SequenceFlow_1o3ihrh" sourceRef="CallActivity_1oc1h9q" targetRef="ScriptTask_04zaa1o" /> + <bpmn2:sequenceFlow id="SequenceFlow_1o3ihrh" sourceRef="CallActivity_1oc1h9q" targetRef="ExclusiveGateway_0h0cq5k" /> <bpmn2:sequenceFlow id="SequenceFlow_1tfe975" sourceRef="IntermediateCatchEvent_00tv706" targetRef="ScriptTask_1vr3ks5" /> - <bpmn2:sequenceFlow id="SequenceFlow_14ajbme" sourceRef="ScriptTask_04zaa1o" targetRef="IntermediateThrowEvent_1tbopzu" /> - <bpmn2:sequenceFlow id="SequenceFlow_1hjh5zy" sourceRef="IntermediateCatchEvent_1aouco1" targetRef="doCreateServiceInstance_CallActivity" /> + <bpmn2:sequenceFlow id="SequenceFlow_14ajbme" sourceRef="CallActivity_1y1p4bd" targetRef="IntermediateThrowEvent_1tbopzu" /> + <bpmn2:sequenceFlow id="SequenceFlow_1hjh5zy" sourceRef="IntermediateCatchEvent_1aouco1" targetRef="ScriptTask_04zaa1o" /> + <bpmn2:callActivity id="CallActivity_1y1p4bd" name="Call Homing Service" camunda:modelerTemplate="homingBlock" calledElement="Homing"> + <bpmn2:extensionElements> + <camunda:in source="true" target="isDebugLogEnabled" /> + <camunda:in source="null" target="timeout" /> + <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:out source="rolledBack" target="rolledBack" /> + <camunda:out source="rollbackData" target="rollbackData" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:in source="subscriberInfo" target="subscriberInfo" /> + <camunda:in source="homingService" target="homingService" /> + <camunda:in source="customerLocation" target="customerLocation" /> + <camunda:in source="cloudOwner" target="cloudOwner" /> + <camunda:in source="cloudRegionId" target="cloudRegionId" /> + <camunda:in source="serviceInstanceName" target="serviceInstanceName" /> + <camunda:in source="homingModelIds" target="homingModelIds" /> + <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_0bng27u</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_14ajbme</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:scriptTask id="ScriptTask_1imcb54" name="PostProcess Decompose Service " scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0vcumrm</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0bng27u</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateGenericALaCarteServiceInstance() +csi.processDecomposition(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_0bng27u" sourceRef="ScriptTask_1imcb54" targetRef="CallActivity_1y1p4bd" /> + <bpmn2:sequenceFlow id="SequenceFlow_1fv5tk6" sourceRef="ScriptTask_04zaa1o" targetRef="doCreateServiceInstance_CallActivity" /> + <bpmn2:exclusiveGateway id="ExclusiveGateway_0h0cq5k" name="Home Service?"> + <bpmn2:incoming>SequenceFlow_1o3ihrh</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0vcumrm</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_0xrox26</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_0vcumrm" sourceRef="ExclusiveGateway_0h0cq5k" targetRef="ScriptTask_1imcb54"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("homingService") == "oof"}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0hhmvlw" name="GoToCreateSI"> + <bpmn2:incoming>SequenceFlow_0xrox26</bpmn2:incoming> + <bpmn2:linkEventDefinition name="CreateSI" /> + </bpmn2:intermediateThrowEvent> + <bpmn2:sequenceFlow id="SequenceFlow_0xrox26" sourceRef="ExclusiveGateway_0h0cq5k" targetRef="IntermediateThrowEvent_0hhmvlw" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -229,19 +274,19 @@ csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_CallActivity_72" bpmnElement="doCreateServiceInstance_CallActivity"> - <dc:Bounds x="112" y="452" width="100" height="80" /> + <dc:Bounds x="321" y="452" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0o440av_di" bpmnElement="EndEvent_0o440av"> - <dc:Bounds x="852" y="474" width="36" height="36" /> + <dc:Bounds x="1004" y="474" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="863" y="510" width="20" height="14" /> + <dc:Bounds x="1015" y="510" width="20" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1lj31zp_di" bpmnElement="SequenceFlow_1lj31zp"> - <di:waypoint xsi:type="dc:Point" x="212" y="492" /> - <di:waypoint xsi:type="dc:Point" x="314" y="492" /> + <di:waypoint xsi:type="dc:Point" x="421" y="492" /> + <di:waypoint xsi:type="dc:Point" x="500" y="492" /> <bpmndi:BPMNLabel> - <dc:Bounds x="263" y="477" width="0" height="0" /> + <dc:Bounds x="415.5" y="477" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0pvcr6j_di" bpmnElement="ScriptTask_0pvcr6j"> @@ -255,16 +300,16 @@ csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0cihgpv_di" bpmnElement="ScriptTask_0cihgpv"> - <dc:Bounds x="449" y="452" width="100" height="80" /> + <dc:Bounds x="637" y="452" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0sevgre_di" bpmnElement="CallActivity_0sevgre"> - <dc:Bounds x="637" y="452" width="100" height="80" /> + <dc:Bounds x="820" y="452" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0xxvjxq_di" bpmnElement="SequenceFlow_0xxvjxq"> - <di:waypoint xsi:type="dc:Point" x="549" y="492" /> - <di:waypoint xsi:type="dc:Point" x="637" y="492" /> + <di:waypoint xsi:type="dc:Point" x="737" y="492" /> + <di:waypoint xsi:type="dc:Point" x="820" y="492" /> <bpmndi:BPMNLabel> - <dc:Bounds x="593" y="477" width="0" height="0" /> + <dc:Bounds x="733.5" y="477" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1hql91g_di" bpmnElement="ScriptTask_1hql91g"> @@ -303,10 +348,10 @@ csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_095crcd_di" bpmnElement="SequenceFlow_095crcd"> - <di:waypoint xsi:type="dc:Point" x="737" y="492" /> - <di:waypoint xsi:type="dc:Point" x="852" y="492" /> + <di:waypoint xsi:type="dc:Point" x="920" y="492" /> + <di:waypoint xsi:type="dc:Point" x="1004" y="492" /> <bpmndi:BPMNLabel> - <dc:Bounds x="795" y="477" width="0" height="0" /> + <dc:Bounds x="917" y="477" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0n4umjf_di" bpmnElement="SequenceFlow_0n4umjf"> @@ -341,33 +386,31 @@ csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_1x5i9c1_di" bpmnElement="ExclusiveGateway_1x5i9c1" isMarkerVisible="true"> - <dc:Bounds x="314" y="467" width="50" height="50" /> + <dc:Bounds x="500" y="467" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="314" y="439" width="50" height="14" /> + <dc:Bounds x="501" y="439" width="49" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_143akoz_di" bpmnElement="EndEvent_143akoz"> - <dc:Bounds x="321" y="580" width="36" height="36" /> + <dc:Bounds x="507" y="580" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="417" y="965" width="0" height="0" /> + <dc:Bounds x="558" y="965" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1o4wwba_di" bpmnElement="SequenceFlow_1o4wwba"> - <di:waypoint xsi:type="dc:Point" x="364" y="492" /> - <di:waypoint xsi:type="dc:Point" x="401" y="492" /> - <di:waypoint xsi:type="dc:Point" x="401" y="492" /> - <di:waypoint xsi:type="dc:Point" x="449" y="492" /> + <di:waypoint xsi:type="dc:Point" x="550" y="492" /> + <di:waypoint xsi:type="dc:Point" x="637" y="492" /> <bpmndi:BPMNLabel> - <dc:Bounds x="399" y="489" width="18" height="14" /> + <dc:Bounds x="554.09375" y="489" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1mdnv3l_di" bpmnElement="SequenceFlow_1mdnv3l"> - <di:waypoint xsi:type="dc:Point" x="339" y="517" /> - <di:waypoint xsi:type="dc:Point" x="339" y="544" /> - <di:waypoint xsi:type="dc:Point" x="339" y="544" /> - <di:waypoint xsi:type="dc:Point" x="339" y="580" /> + <di:waypoint xsi:type="dc:Point" x="525" y="517" /> + <di:waypoint xsi:type="dc:Point" x="525" y="549" /> + <di:waypoint xsi:type="dc:Point" x="525" y="549" /> + <di:waypoint xsi:type="dc:Point" x="525" y="580" /> <bpmndi:BPMNLabel> - <dc:Bounds x="313" y="522" width="12" height="14" /> + <dc:Bounds x="514" y="524.0370370370371" width="13" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_0y5991s_di" bpmnElement="IntermediateThrowEvent_0y5991s"> @@ -396,9 +439,9 @@ csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_1tbopzu_di" bpmnElement="IntermediateThrowEvent_1tbopzu"> - <dc:Bounds x="852" y="272" width="36" height="36" /> + <dc:Bounds x="1004" y="272" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="835" y="313" width="70" height="12" /> + <dc:Bounds x="986" y="313" width="72" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1vr3ks5_di" bpmnElement="ScriptTask_1vr3ks5"> @@ -408,7 +451,7 @@ csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> <dc:Bounds x="342" y="250" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_04zaa1o_di" bpmnElement="ScriptTask_04zaa1o"> - <dc:Bounds x="555" y="250" width="100" height="80" /> + <dc:Bounds x="112" y="452" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0xhu1k3_di" bpmnElement="SequenceFlow_0xhu1k3"> <di:waypoint xsi:type="dc:Point" x="212" y="290" /> @@ -419,9 +462,9 @@ csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1o3ihrh_di" bpmnElement="SequenceFlow_1o3ihrh"> <di:waypoint xsi:type="dc:Point" x="442" y="290" /> - <di:waypoint xsi:type="dc:Point" x="555" y="290" /> + <di:waypoint xsi:type="dc:Point" x="500" y="290" /> <bpmndi:BPMNLabel> - <dc:Bounds x="499" y="275" width="0" height="0" /> + <dc:Bounds x="426" y="275" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1tfe975_di" bpmnElement="SequenceFlow_1tfe975"> @@ -434,17 +477,63 @@ csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_14ajbme_di" bpmnElement="SequenceFlow_14ajbme"> - <di:waypoint xsi:type="dc:Point" x="655" y="290" /> - <di:waypoint xsi:type="dc:Point" x="852" y="290" /> + <di:waypoint xsi:type="dc:Point" x="930" y="290" /> + <di:waypoint xsi:type="dc:Point" x="1004" y="290" /> <bpmndi:BPMNLabel> - <dc:Bounds x="754" y="265" width="0" height="0" /> + <dc:Bounds x="922" y="275" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1hjh5zy_di" bpmnElement="SequenceFlow_1hjh5zy"> <di:waypoint xsi:type="dc:Point" x="30" y="492" /> <di:waypoint xsi:type="dc:Point" x="112" y="492" /> <bpmndi:BPMNLabel> - <dc:Bounds x="71" y="467" width="0" height="0" /> + <dc:Bounds x="26" y="477" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1y1p4bd_di" bpmnElement="CallActivity_1y1p4bd"> + <dc:Bounds x="830" y="250" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1imcb54_di" bpmnElement="ScriptTask_1imcb54"> + <dc:Bounds x="637" y="250" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0bng27u_di" bpmnElement="SequenceFlow_0bng27u"> + <di:waypoint xsi:type="dc:Point" x="737" y="290" /> + <di:waypoint xsi:type="dc:Point" x="830" y="290" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="783.5" y="269" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1fv5tk6_di" bpmnElement="SequenceFlow_1fv5tk6"> + <di:waypoint xsi:type="dc:Point" x="212" y="492" /> + <di:waypoint xsi:type="dc:Point" x="321" y="492" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="266.5" y="471" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_0h0cq5k_di" bpmnElement="ExclusiveGateway_0h0cq5k" isMarkerVisible="true"> + <dc:Bounds x="499.52351097178683" y="265" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="488" y="319" width="77" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0vcumrm_di" bpmnElement="SequenceFlow_0vcumrm"> + <di:waypoint xsi:type="dc:Point" x="550" y="290" /> + <di:waypoint xsi:type="dc:Point" x="637" y="290" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="593.5" y="269" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_0hhmvlw_di" bpmnElement="IntermediateThrowEvent_0hhmvlw"> + <dc:Bounds x="507" y="342" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="489" y="383" width="72" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0xrox26_di" bpmnElement="SequenceFlow_0xrox26"> + <di:waypoint xsi:type="dc:Point" x="525" y="315" /> + <di:waypoint xsi:type="dc:Point" x="525" y="342" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="540" y="322.5" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn index a4e7ae1b1a..a94569c29b 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.16.2"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.0"> <bpmn:process id="CreateSDNCNetworkResource" name="CreateSDNCNetworkResource" isExecutable="true"> <bpmn:startEvent id="createNS_StartEvent" name="createNS_StartEvent"> <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> @@ -7,7 +7,7 @@ <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="createNS_StartEvent" targetRef="Task_1dlrfiw" /> <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="Task_0tezqd4" /> <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="prepare SDNC Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_18l3crb</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0svppaq</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new CreateSDNCNetworkResource() @@ -18,27 +18,19 @@ dcsi.prepareSDNCRequest(execution)</bpmn:script> </bpmn:endEvent> <bpmn:callActivity id="CallActivity_1600xlj" name="Call SDNC RSRC Create Adapter V1 " calledElement="sdncAdapter"> <bpmn:extensionElements> - <camunda:in source="CRESDNCRES_activateSDNCRequest" target="sdncAdapterWorkflowRequest" /> <camunda:in source="mso-request-id" target="mso-request-id" /> <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> - <camunda:out source="sdncAdapterResponse" target="CRENWKI_activateSDNCResponse" /> + <camunda:out source="sdncAdapterResponse" target="CRENWKI_createSDNCResponse" /> <camunda:out source="SDNCA_ResponseCode" target="CRESDNCRES_sdncCreateReturnCode" /> <camunda:out source="SDNCA_SuccessIndicator" target="CRESDNCRES_SuccessIndicator" /> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_15mvedq</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1ex9ov6</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0u8d8j5</bpmn:outgoing> </bpmn:callActivity> - <bpmn:scriptTask id="Task_023hred" name="post SDNC create call"> - <bpmn:incoming>SequenceFlow_1ex9ov6</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1kzj1j5</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new CreateSDNCNetworkResource() -dcsi.postCreateSDNCCall(execution)</bpmn:script> - </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_0w2es8j" sourceRef="Task_1dlrfiw" targetRef="Task_13sx2bp" /> - <bpmn:sequenceFlow id="SequenceFlow_18l3crb" sourceRef="Task_13sx2bp" targetRef="PreprocessIncomingRequest_task" /> + <bpmn:sequenceFlow id="SequenceFlow_18l3crb" sourceRef="Task_13sx2bp" targetRef="Task_1mbzgl7" /> <bpmn:scriptTask id="Task_1dlrfiw" name="Set the Recipe DesignTimeParam" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0w2es8j</bpmn:outgoing> @@ -103,27 +95,24 @@ dcsi.prepareUpdateBeforeCreateSDNCResource(execution)</bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1kzj1j5</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0o7h0ag</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_1cd8ujq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0drbyvd</bpmn:outgoing> </bpmn:serviceTask> <bpmn:scriptTask id="ScriptTask_1g5zyi6" name="Send Sync Ack Response" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1cd8ujq</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0drbyvd</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0auvfvm</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi = new CreateSDNCNetworkResource() csi.sendSyncResponse(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_0cdulnk" name="is activate required"> - <bpmn:incoming>SequenceFlow_0o7h0ag</bpmn:incoming> + <bpmn:exclusiveGateway id="ExclusiveGateway_0cdulnk" name="is deActivate required" default="SequenceFlow_05m2j56"> + <bpmn:incoming>SequenceFlow_0oqe2oa</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1dww8ye</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_05m2j56</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_1dww8ye" name="yes" sourceRef="ExclusiveGateway_0cdulnk" targetRef="Task_0bga3e8"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isActivateRequired") == "true")}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1ex9ov6" sourceRef="CallActivity_1600xlj" targetRef="Task_023hred" /> - <bpmn:sequenceFlow id="SequenceFlow_1kzj1j5" sourceRef="Task_023hred" targetRef="ServiceTask_1cm8iwr" /> - <bpmn:sequenceFlow id="SequenceFlow_0o7h0ag" sourceRef="ServiceTask_1cm8iwr" targetRef="ExclusiveGateway_0cdulnk" /> <bpmn:scriptTask id="Task_0uwlr22" name="Create progress update parameters After create" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_05m2j56</bpmn:incoming> <bpmn:incoming>SequenceFlow_05niqbf</bpmn:incoming> @@ -134,7 +123,7 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_05m2j56" name="No" sourceRef="ExclusiveGateway_0cdulnk" targetRef="Task_0uwlr22" /> <bpmn:sequenceFlow id="SequenceFlow_05niqbf" sourceRef="Task_0bga3e8" targetRef="Task_0uwlr22" /> - <bpmn:sequenceFlow id="SequenceFlow_1cd8ujq" sourceRef="Task_0uwlr22" targetRef="ScriptTask_1g5zyi6" /> + <bpmn:sequenceFlow id="SequenceFlow_1cd8ujq" sourceRef="Task_0uwlr22" targetRef="ServiceTask_1cm8iwr" /> <bpmn:sequenceFlow id="SequenceFlow_0auvfvm" sourceRef="ScriptTask_1g5zyi6" targetRef="EndEvent_1x6k78c" /> <bpmn:callActivity id="Task_0bga3e8" name="call Activate SDNC network Resource" calledElement="ActivateSDNCNetworkResource"> <bpmn:extensionElements> @@ -148,36 +137,55 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)</bpmn:script> <camunda:in source="requestAction" target="requestAction" /> <camunda:in source="URN_mso_workflow_sdncadapter_callback" target="URN_mso_workflow_sdncadapter_callback" /> <camunda:in source="networkRequest" target="networkRequest" /> + <camunda:in source="networkInstanceId" target="networkInstanceId" /> + <camunda:in source="parentServiceInstanceId" target="parentServiceInstanceId" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1dww8ye</bpmn:incoming> <bpmn:outgoing>SequenceFlow_05niqbf</bpmn:outgoing> </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0svppaq" sourceRef="Task_1mbzgl7" targetRef="PreprocessIncomingRequest_task" /> + <bpmn:scriptTask id="Task_1mbzgl7" name="Update resource input" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_18l3crb</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0svppaq</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateSDNCNetworkResource() +dcsi.updateResourceInput(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0drbyvd" sourceRef="ServiceTask_1cm8iwr" targetRef="ScriptTask_1g5zyi6" /> + <bpmn:sequenceFlow id="SequenceFlow_0u8d8j5" sourceRef="CallActivity_1600xlj" targetRef="Task_1czbh37" /> + <bpmn:sequenceFlow id="SequenceFlow_0oqe2oa" sourceRef="Task_1czbh37" targetRef="ExclusiveGateway_0cdulnk" /> + <bpmn:scriptTask id="Task_1czbh37" name="post SDNC create call" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0u8d8j5</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0oqe2oa</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateSDNCNetworkResource() +dcsi.afterCreateSDNCCall(execution)</bpmn:script> + </bpmn:scriptTask> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateSDNCNetworkResource"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createNS_StartEvent"> - <dc:Bounds x="-111" y="111" width="36" height="36" /> + <dc:Bounds x="-188" y="111" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-135" y="147" width="85" height="24" /> + <dc:Bounds x="-214" y="147" width="89" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> - <di:waypoint x="-75" y="129" /> - <di:waypoint x="-10" y="129" /> + <di:waypoint x="-152" y="129" /> + <di:waypoint x="-96" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="-87.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> - <di:waypoint x="413" y="129" /> - <di:waypoint x="460" y="129" /> - <di:waypoint x="500" y="129" /> + <di:waypoint x="513" y="129" /> + <di:waypoint x="573" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="391.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> - <dc:Bounds x="313" y="89" width="100" height="80" /> + <dc:Bounds x="413" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> <dc:Bounds x="1046" y="317" width="36" height="36" /> @@ -188,33 +196,28 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)</bpmn:script> <bpmndi:BPMNShape id="CallActivity_1600xlj_di" bpmnElement="CallActivity_1600xlj"> <dc:Bounds x="-10" y="295" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred"> - <dc:Bounds x="172" y="295" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0w2es8j_di" bpmnElement="SequenceFlow_0w2es8j"> - <di:waypoint x="90" y="129" /> - <di:waypoint x="148" y="129" /> + <di:waypoint x="4" y="129" /> + <di:waypoint x="67" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="74" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb"> - <di:waypoint x="248" y="129" /> - <di:waypoint x="313" y="129" /> + <di:waypoint x="167" y="129" /> + <di:waypoint x="231" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="235.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0lc6l7a_di" bpmnElement="Task_1dlrfiw"> - <dc:Bounds x="-10" y="89" width="100" height="80" /> + <dc:Bounds x="-96" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp"> - <dc:Bounds x="148" y="89" width="100" height="80" /> + <dc:Bounds x="67" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1mz0vdx_di" bpmnElement="SequenceFlow_1mz0vdx"> - <di:waypoint x="606" y="129" /> - <di:waypoint x="638" y="129" /> - <di:waypoint x="638" y="129" /> + <di:waypoint x="673" y="129" /> <di:waypoint x="738" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="608" y="123" width="90" height="12" /> @@ -225,75 +228,85 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)</bpmn:script> <di:waypoint x="788" y="218" /> <di:waypoint x="-89" y="218" /> <di:waypoint x="-89" y="335" /> - <di:waypoint x="-10" y="335" /> + <di:waypoint x="-17" y="335" /> <bpmndi:BPMNLabel> <dc:Bounds x="349" y="197" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1kqf4ge_di" bpmnElement="Task_0tezqd4"> - <dc:Bounds x="506" y="89" width="100" height="80" /> + <dc:Bounds x="573" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1q6ssz7_di" bpmnElement="Task_18tomkl"> <dc:Bounds x="738" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1cm8iwr_di" bpmnElement="ServiceTask_1cm8iwr"> - <dc:Bounds x="366" y="295" width="100" height="80" /> + <dc:Bounds x="720" y="295" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1g5zyi6_di" bpmnElement="ScriptTask_1g5zyi6"> <dc:Bounds x="890" y="295" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0cdulnk_di" bpmnElement="ExclusiveGateway_0cdulnk" isMarkerVisible="true"> - <dc:Bounds x="539" y="310" width="50" height="50" /> + <dc:Bounds x="371" y="310" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="539" y="273" width="49" height="27" /> + <dc:Bounds x="365" y="273" width="63" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1dww8ye_di" bpmnElement="SequenceFlow_1dww8ye"> - <di:waypoint x="564" y="360" /> - <di:waypoint x="564" y="471" /> - <di:waypoint x="608" y="471" /> + <di:waypoint x="396" y="360" /> + <di:waypoint x="396" y="471" /> + <di:waypoint x="440" y="471" /> <bpmndi:BPMNLabel> - <dc:Bounds x="571" y="391" width="18" height="14" /> + <dc:Bounds x="403" y="391" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1ex9ov6_di" bpmnElement="SequenceFlow_1ex9ov6"> - <di:waypoint x="90" y="335" /> - <di:waypoint x="172" y="335" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1kzj1j5_di" bpmnElement="SequenceFlow_1kzj1j5"> - <di:waypoint x="272" y="335" /> - <di:waypoint x="366" y="335" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0o7h0ag_di" bpmnElement="SequenceFlow_0o7h0ag"> - <di:waypoint x="466" y="335" /> - <di:waypoint x="539" y="335" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0hu4lhm_di" bpmnElement="Task_0uwlr22"> - <dc:Bounds x="721" y="295" width="100" height="80" /> + <dc:Bounds x="553" y="295" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_05m2j56_di" bpmnElement="SequenceFlow_05m2j56"> - <di:waypoint x="589" y="335" /> - <di:waypoint x="721" y="335" /> + <di:waypoint x="421" y="335" /> + <di:waypoint x="553" y="335" /> <bpmndi:BPMNLabel> - <dc:Bounds x="648" y="317" width="14" height="14" /> + <dc:Bounds x="480" y="317" width="15" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_05niqbf_di" bpmnElement="SequenceFlow_05niqbf"> - <di:waypoint x="708" y="471" /> - <di:waypoint x="771" y="471" /> - <di:waypoint x="771" y="375" /> + <di:waypoint x="540" y="471" /> + <di:waypoint x="603" y="471" /> + <di:waypoint x="603" y="375" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1cd8ujq_di" bpmnElement="SequenceFlow_1cd8ujq"> - <di:waypoint x="821" y="335" /> - <di:waypoint x="890" y="335" /> + <di:waypoint x="653" y="335" /> + <di:waypoint x="720" y="335" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0auvfvm_di" bpmnElement="SequenceFlow_0auvfvm"> <di:waypoint x="990" y="335" /> <di:waypoint x="1046" y="335" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_0aywvn3_di" bpmnElement="Task_0bga3e8"> - <dc:Bounds x="608" y="431" width="100" height="80" /> + <dc:Bounds x="440" y="431" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0svppaq_di" bpmnElement="SequenceFlow_0svppaq"> + <di:waypoint x="331" y="129" /> + <di:waypoint x="413" y="129" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1kzr9lu_di" bpmnElement="Task_1mbzgl7"> + <dc:Bounds x="231" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0drbyvd_di" bpmnElement="SequenceFlow_0drbyvd"> + <di:waypoint x="820" y="335" /> + <di:waypoint x="890" y="335" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0u8d8j5_di" bpmnElement="SequenceFlow_0u8d8j5"> + <di:waypoint x="90" y="335" /> + <di:waypoint x="185" y="335" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0oqe2oa_di" bpmnElement="SequenceFlow_0oqe2oa"> + <di:waypoint x="285" y="335" /> + <di:waypoint x="371" y="335" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1njkyn8_di" bpmnElement="Task_1czbh37"> + <dc:Bounds x="185" y="295" width="100" height="80" /> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions> +</bpmn:definitions>
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DeActivateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn index 3442d68c45..09d8e35258 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DeActivateSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn @@ -1,60 +1,60 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.16.2"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.0"> <bpmn:process id="DeActivateSDNCNetworkResource" name="DeActivateSDNCNetworkResource" isExecutable="true"> - <bpmn:startEvent id="deleteNetworkResource_StartEvent" name="deleteNetworkResource_StartEvent"> + <bpmn:startEvent id="deleteNetworkResource_StartEvent_deactivate" name="deleteNetworkResource_StartEvent"> <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> </bpmn:startEvent> - <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="deleteNetworkResource_StartEvent" targetRef="Task_13sx2bp" /> - <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="CallActivity_1600xlj" /> - <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="prepare SDNC Deactivate Request" scriptFormat="groovy"> + <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="deleteNetworkResource_StartEvent_deactivate" targetRef="Task_13sx2bp_deactivate" /> + <bpmn:scriptTask id="PreprocessIncomingRequest_deactivate" name="prepare SDNC Deactivate Request" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_18l3crb</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* + <bpmn:outgoing>SequenceFlow_1fjtgq7</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0nmt8ph</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DeActivateSDNCNetworkResource() dcsi.prepareSDNCRequest(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:endEvent id="EndEvent_1x6k78c" name="delete SDNC call end"> + <bpmn:endEvent id="EndEvent_1x6k78c_deactivate" name="delete SDNC call end"> <bpmn:incoming>SequenceFlow_15wux6a</bpmn:incoming> </bpmn:endEvent> - <bpmn:callActivity id="CallActivity_1600xlj" name="Call SDNC Adapter V1 " calledElement="sdncAdapter"> - <bpmn:extensionElements> - <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> - <camunda:in source="mso-request-id" target="mso-request-id" /> - <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> - <camunda:out source="sdncAdapterResponse" target="DELSDNCRES_activateSDNCResponse" /> - <camunda:out source="SDNCA_ResponseCode" target="DELSDNCRES_sdncDeleteReturnCode" /> - <camunda:out source="SDNCA_SuccessIndicator" target="DELSDNCRES_SuccessIndicator" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0uig0sx</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred" targetRef="ScriptTask_1emjxm2" /> - <bpmn:scriptTask id="Task_023hred" name="post SDNC deactivate call"> - <bpmn:incoming>SequenceFlow_0x5f1o7</bpmn:incoming> + <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred_deactivate" targetRef="ScriptTask_1emjxm2_deactivate" /> + <bpmn:scriptTask id="Task_023hred_deactivate" name="post SDNC deactivate call"> + <bpmn:incoming>SequenceFlow_13gl3wv</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0ow44q0</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DeActivateSDNCNetworkResource() dcsi.postDeactivateSDNCCall(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_18l3crb" sourceRef="Task_13sx2bp" targetRef="PreprocessIncomingRequest_task" /> - <bpmn:scriptTask id="Task_13sx2bp" name="Pre Process Request" scriptFormat="groovy"> + <bpmn:sequenceFlow id="SequenceFlow_18l3crb" sourceRef="Task_13sx2bp_deactivate" targetRef="PreprocessIncomingRequest_deactivate" /> + <bpmn:scriptTask id="Task_13sx2bp_deactivate" name="Pre Process Request" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> <bpmn:outgoing>SequenceFlow_18l3crb</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new DeleteSDNDeActivateSDNCNetworkResourceCNetworkResource() + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DeActivateSDNCNetworkResource() dcsi.preProcessRequest(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_1mz0vdx" sourceRef="Task_0tezqd4" targetRef="Task_18tomkl" /> - <bpmn:scriptTask id="Task_0tezqd4" name="Delete progress update parameters after deactivate" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0uig0sx</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1mz0vdx</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* + <bpmn:scriptTask id="Task_0tezqd4_deactivate" name="Delete progress update parameters after deactivate" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0rn8vky</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1pzm7qx</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DeActivateSDNCNetworkResource() dcsi.prepareUpdateAfterDeActivateSDNCResource(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:serviceTask id="Task_18tomkl" name="update progress update"> + <bpmn:scriptTask id="ScriptTask_1emjxm2_deactivate" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15wux6a</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new DeActivateSDNCNetworkResource() +csi.sendSyncResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_15wux6a" sourceRef="ScriptTask_1emjxm2_deactivate" targetRef="EndEvent_1x6k78c_deactivate" /> + <bpmn:sequenceFlow id="SequenceFlow_1fjtgq7" sourceRef="PreprocessIncomingRequest_deactivate" targetRef="Task_0n0lj30_deactivate" /> + <bpmn:callActivity id="Task_0n0lj30_deactivate" name="Call SDNC Adapter V1" calledElement="SDNCAdapterRestV1"> + <bpmn:incoming>SequenceFlow_1fjtgq7</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0c58p9k</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0c58p9k" sourceRef="Task_0n0lj30_deactivate" targetRef="Task_0tezqd4_deactivate" /> + <bpmn:sequenceFlow id="SequenceFlow_1pzm7qx" sourceRef="Task_0tezqd4_deactivate" targetRef="Task_1a6f0p9_deactivate" /> + <bpmn:serviceTask id="Task_1a6f0p9_deactivate" name="update progress update"> <bpmn:extensionElements> <camunda:connector> <camunda:inputOutput> @@ -73,26 +73,34 @@ dcsi.prepareUpdateAfterDeActivateSDNCResource(execution)</bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1mz0vdx</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0x5f1o7</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_1pzm7qx</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_13gl3wv</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:scriptTask id="ScriptTask_1emjxm2" name="Send Sync Ack Response" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_15wux6a</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi = new DeActivateSDNCNetworkResource() -csi.sendSyncResponse(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_15wux6a" sourceRef="ScriptTask_1emjxm2" targetRef="EndEvent_1x6k78c" /> - <bpmn:sequenceFlow id="SequenceFlow_0uig0sx" sourceRef="CallActivity_1600xlj" targetRef="Task_0tezqd4" /> - <bpmn:sequenceFlow id="SequenceFlow_0x5f1o7" sourceRef="Task_18tomkl" targetRef="Task_023hred" /> + <bpmn:sequenceFlow id="SequenceFlow_13gl3wv" sourceRef="Task_1a6f0p9_deactivate" targetRef="Task_023hred_deactivate" /> + <bpmn:callActivity id="CallActivity_0a0txik_DeActivate" name="Call SDNC RSRC Adapter V1 " calledElement="sdncAdapter"> + <bpmn:extensionElements> + <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="sdncAdapterResponse" target="DELSDNCRES_activateSDNCResponse" /> + <camunda:out source="SDNCA_ResponseCode" target="DELSDNCRES_sdncDeleteReturnCode" /> + <camunda:out source="SDNCA_SuccessIndicator" target="DELSDNCRES_SuccessIndicator" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1fjtgq7</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0nmt8ph</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0rn8vky</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0rn8vky" sourceRef="CallActivity_0a0txik_DeActivate" targetRef="Task_0tezqd4_deactivate" /> + <bpmn:sequenceFlow id="SequenceFlow_0nmt8ph" sourceRef="PreprocessIncomingRequest_deactivate" targetRef="CallActivity_0a0txik_DeActivate" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeActivateSDNCNetworkResource"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="deleteNetworkResource_StartEvent"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="deleteNetworkResource_StartEvent_deactivate"> <dc:Bounds x="-111" y="111" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-136" y="147" width="89" height="28" /> + <dc:Bounds x="-135" y="147" width="88" height="40" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> @@ -102,25 +110,15 @@ csi.sendSyncResponse(execution)</bpmn:script> <dc:Bounds x="-87.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> - <di:waypoint x="278" y="129" /> - <di:waypoint x="333" y="129" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="391.5" y="108" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> + <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_deactivate"> <dc:Bounds x="178" y="89" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> + <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c_deactivate"> <dc:Bounds x="964" y="327" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="928" y="369" width="84" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_1600xlj_di" bpmnElement="CallActivity_1600xlj"> - <dc:Bounds x="333" y="89" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0"> <di:waypoint x="735" y="345" /> <di:waypoint x="795" y="345" /> @@ -128,7 +126,7 @@ csi.sendSyncResponse(execution)</bpmn:script> <dc:Bounds x="719" y="314" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred"> + <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred_deactivate"> <dc:Bounds x="635" y="305" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb"> @@ -138,23 +136,13 @@ csi.sendSyncResponse(execution)</bpmn:script> <dc:Bounds x="235.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp"> + <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp_deactivate"> <dc:Bounds x="5" y="89" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1mz0vdx_di" bpmnElement="SequenceFlow_1mz0vdx"> - <di:waypoint x="433" y="345" /> - <di:waypoint x="481" y="345" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="608" y="123" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1kqf4ge_di" bpmnElement="Task_0tezqd4"> + <bpmndi:BPMNShape id="ScriptTask_1kqf4ge_di" bpmnElement="Task_0tezqd4_deactivate"> <dc:Bounds x="333" y="305" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1q6ssz7_di" bpmnElement="Task_18tomkl"> - <dc:Bounds x="481" y="305" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1emjxm2_di" bpmnElement="ScriptTask_1emjxm2"> + <bpmndi:BPMNShape id="ScriptTask_1emjxm2_di" bpmnElement="ScriptTask_1emjxm2_deactivate"> <dc:Bounds x="795" y="305" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_15wux6a_di" bpmnElement="SequenceFlow_15wux6a"> @@ -164,14 +152,32 @@ csi.sendSyncResponse(execution)</bpmn:script> <dc:Bounds x="930" y="313" width="0" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0uig0sx_di" bpmnElement="SequenceFlow_0uig0sx"> + <bpmndi:BPMNEdge id="SequenceFlow_1fjtgq7_di" bpmnElement="SequenceFlow_1fjtgq7"> + <di:waypoint x="278" y="129" /> + <di:waypoint x="333" y="129" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1pzm7qx_di" bpmnElement="SequenceFlow_1pzm7qx"> + <di:waypoint x="433" y="345" /> + <di:waypoint x="487" y="345" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0k4fp1d_di" bpmnElement="Task_1a6f0p9_deactivate"> + <dc:Bounds x="487" y="305" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_13gl3wv_di" bpmnElement="SequenceFlow_13gl3wv"> + <di:waypoint x="587" y="345" /> + <di:waypoint x="635" y="345" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0a0txik_di" bpmnElement="CallActivity_0a0txik_DeActivate"> + <dc:Bounds x="333" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0rn8vky_di" bpmnElement="SequenceFlow_0rn8vky"> <di:waypoint x="383" y="169" /> <di:waypoint x="383" y="305" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0x5f1o7_di" bpmnElement="SequenceFlow_0x5f1o7"> - <di:waypoint x="581" y="345" /> - <di:waypoint x="635" y="345" /> + <bpmndi:BPMNEdge id="SequenceFlow_0nmt8ph_di" bpmnElement="SequenceFlow_0nmt8ph"> + <di:waypoint x="278" y="129" /> + <di:waypoint x="333" y="129" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions> +</bpmn:definitions>
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn index 4b6f8d9b26..25fd6af574 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn @@ -14,7 +14,7 @@ dcsi.prepare3rdONAPRequest(execution)]]></bpmn:script> <bpmn:endEvent id="EndEvent_013449q" name="Delete3rdONAPRES_End"> <bpmn:incoming>SequenceFlow_0a8k9xi</bpmn:incoming> </bpmn:endEvent> - <bpmn:scriptTask id="ScriptTask_1b88nnk" name="Delete SPPartner In AAI"> + <bpmn:scriptTask id="ScriptTask_1b88nnk" name="Delete SPPartner In AAI" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0y2g8mr</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0znwu8z</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* @@ -93,7 +93,7 @@ dcsi.doDeleteE2ESIin3rdONAP(execution)]]></bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0fkfn70</bpmn:incoming> + <bpmn:incoming>SequenceFlow_122usz6</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1luhljs</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_190fewc" sourceRef="StartEvent_0hj12gh" targetRef="ScriptTask_160sboy" /> @@ -160,7 +160,7 @@ dcsi.checkLocallCall(execution)]]></bpmn:script> <bpmn:endEvent id="EndEvent_0o0n3fa" name="Delete3rdONAPRES_End"> <bpmn:incoming>SequenceFlow_131f1jj</bpmn:incoming> </bpmn:endEvent> - <bpmn:scriptTask id="ScriptTask_1lazb8l" name="Delete SPPartner In AAI"> + <bpmn:scriptTask id="ScriptTask_1lazb8l" name="Delete SPPartner In AAI" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1wq9f5k</bpmn:incoming> <bpmn:outgoing>SequenceFlow_18gb81f</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* @@ -180,11 +180,11 @@ dcsi.preProcessRequest(execution)]]></bpmn:script> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* execution.setVariable("progress", "100") execution.setVariable("status", "finished") -execution.setVariable("statusDescription", "Local Creation Only") +execution.setVariable("statusDescription", "Local Deletion Only") def dcsi = new Delete3rdONAPE2EServiceInstance() dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:serviceTask id="ServiceTask_1kgvq5e" name="update progress update"> + <bpmn:serviceTask id="ServiceTask_1kgvq5e" name="resource progress update"> <bpmn:extensionElements> <camunda:connector> <camunda:inputOutput> @@ -269,9 +269,9 @@ csi.sendSyncResponse(execution)]]></bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_15mvx68" sourceRef="ScriptTask_0rs5t7w" targetRef="ScriptTask_0r2cxvb" /> <bpmn:sequenceFlow id="SequenceFlow_0wp73cw" sourceRef="ScriptTask_0r2cxvb" targetRef="ExclusiveGateway_1662gjm" /> <bpmn:sequenceFlow id="SequenceFlow_13s0mg5" name="yes" sourceRef="ExclusiveGateway_1662gjm" targetRef="ScriptTask_0yz8d8c"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("serviceOrderId" ) != null && execution.getVariable("serviceOrderId" ) != "" )}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("ServiceOrderId" ) != null && execution.getVariable("ServiceOrderId" ) != "" )}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_0fkfn70" sourceRef="ScriptTask_0yz8d8c" targetRef="ServiceTask_0p5029r" /> + <bpmn:sequenceFlow id="SequenceFlow_0fkfn70" sourceRef="ScriptTask_0yz8d8c" targetRef="ScriptTask_0yiew1d" /> <bpmn:sequenceFlow id="SequenceFlow_1suwdgi" sourceRef="ServiceTask_039ju3f" targetRef="ScriptTask_0rs5t7w" /> <bpmn:sequenceFlow id="SequenceFlow_0kkou66" sourceRef="ScriptTask_1pdhttw" targetRef="ScriptTask_0yz8d8c" /> <bpmn:sequenceFlow id="SequenceFlow_1luhljs" sourceRef="ServiceTask_0p5029r" targetRef="ExclusiveGateway_1we7izu" /> @@ -319,6 +319,14 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0i9iiuo" sourceRef="ScriptTask_07cq0pw" targetRef="ServiceTask_1ixmamy" /> <bpmn:sequenceFlow id="SequenceFlow_1mei7hu" sourceRef="ServiceTask_1ixmamy" targetRef="EndEvent_19joonf" /> + <bpmn:scriptTask id="ScriptTask_0yiew1d" name="update resource progress" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0fkfn70</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_122usz6</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new Create3rdONAPE2EServiceInstance() +dcsi.prepareUpdateProgress(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_122usz6" sourceRef="ScriptTask_0yiew1d" targetRef="ServiceTask_0p5029r" /> </bpmn:process> <bpmn:error id="Error_0nbdy47" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -357,7 +365,7 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> <dc:Bounds x="163" y="12" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0p5029r_di" bpmnElement="ServiceTask_0p5029r"> - <dc:Bounds x="798" y="12" width="100" height="80" /> + <dc:Bounds x="798" y="126" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_190fewc_di" bpmnElement="SequenceFlow_190fewc"> <di:waypoint xsi:type="dc:Point" x="27" y="-400" /> @@ -589,7 +597,7 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1pdhttw_di" bpmnElement="ScriptTask_1pdhttw"> - <dc:Bounds x="573" y="187" width="100" height="80" /> + <dc:Bounds x="573" y="222" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1662gjm_di" bpmnElement="ExclusiveGateway_1662gjm" isMarkerVisible="true"> <dc:Bounds x="386" y="27" width="50" height="50" /> @@ -598,9 +606,9 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1we7izu_di" bpmnElement="ExclusiveGateway_1we7izu" isMarkerVisible="true"> - <dc:Bounds x="823" y="202" width="50" height="50" /> + <dc:Bounds x="823" y="237" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="880" y="206" width="68" height="42" /> + <dc:Bounds x="878" y="241" width="72" height="36" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_18auy29_di" bpmnElement="ScriptTask_18auy29"> @@ -654,24 +662,24 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0kkou66_di" bpmnElement="SequenceFlow_0kkou66"> - <di:waypoint xsi:type="dc:Point" x="623" y="187" /> + <di:waypoint xsi:type="dc:Point" x="623" y="222" /> <di:waypoint xsi:type="dc:Point" x="623" y="92" /> <bpmndi:BPMNLabel> - <dc:Bounds x="593" y="132.5" width="90" height="14" /> + <dc:Bounds x="593" y="150" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1luhljs_di" bpmnElement="SequenceFlow_1luhljs"> - <di:waypoint xsi:type="dc:Point" x="848" y="92" /> - <di:waypoint xsi:type="dc:Point" x="848" y="202" /> + <di:waypoint xsi:type="dc:Point" x="848" y="206" /> + <di:waypoint xsi:type="dc:Point" x="848" y="237" /> <bpmndi:BPMNLabel> - <dc:Bounds x="818" y="140" width="90" height="14" /> + <dc:Bounds x="818" y="214.5" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1udji9x_di" bpmnElement="SequenceFlow_1udji9x"> - <di:waypoint xsi:type="dc:Point" x="823" y="227" /> - <di:waypoint xsi:type="dc:Point" x="673" y="227" /> + <di:waypoint xsi:type="dc:Point" x="823" y="262" /> + <di:waypoint xsi:type="dc:Point" x="673" y="262" /> <bpmndi:BPMNLabel> - <dc:Bounds x="746" y="208" width="12" height="14" /> + <dc:Bounds x="746" y="243" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_19joonf_di" bpmnElement="EndEvent_19joonf"> @@ -690,12 +698,12 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0y2g8mr_di" bpmnElement="SequenceFlow_0y2g8mr"> - <di:waypoint xsi:type="dc:Point" x="848" y="252" /> + <di:waypoint xsi:type="dc:Point" x="848" y="287" /> <di:waypoint xsi:type="dc:Point" x="848" y="324" /> <di:waypoint xsi:type="dc:Point" x="9" y="324" /> <di:waypoint xsi:type="dc:Point" x="9" y="371" /> <bpmndi:BPMNLabel> - <dc:Bounds x="419.8991436726927" y="302" width="18" height="14" /> + <dc:Bounds x="419" y="302" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_07cq0pw_di" bpmnElement="ScriptTask_07cq0pw"> @@ -718,6 +726,16 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> <dc:Bounds x="326.5" y="193" width="0" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0yiew1d_di" bpmnElement="ScriptTask_0yiew1d"> + <dc:Bounds x="798" y="12" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_122usz6_di" bpmnElement="SequenceFlow_122usz6"> + <di:waypoint xsi:type="dc:Point" x="848" y="92" /> + <di:waypoint xsi:type="dc:Point" x="848" y="126" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="863" y="103" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn index be15908697..f0baac0254 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3"> - <bpmn:process id="DeleteDeviceResource.bpmn" name="DeleteDeviceResource.bpmn" isExecutable="true"> + <bpmn:process id="DeleteDeviceResource" name="DeleteDeviceResource" isExecutable="true"> <bpmn:endEvent id="EndEvent_1x6k78c" name="delete Dev end"> <bpmn:incoming>SequenceFlow_0auvfvm</bpmn:incoming> </bpmn:endEvent> @@ -8,7 +8,7 @@ <bpmn:incoming>SequenceFlow_05niqbf</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0auvfvm</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def csi = new DeleteDeviceResource.bpmn() +def csi = new DeleteDeviceResource() csi.sendSyncResponse(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_05niqbf" sourceRef="Task_0bga3e8" targetRef="ScriptTask_1g5zyi6" /> @@ -43,11 +43,11 @@ csi.sendSyncResponse(execution)]]></bpmn:script> def dcsi = new DeleteDeviceResource() dcsi.checkDevType(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_0kba700" name="Dev Type" default="SequenceFlow_076ma0v"> + <bpmn:exclusiveGateway id="ExclusiveGateway_0kba700" name="Dev Type" default="SequenceFlow_1g6azih"> <bpmn:incoming>SequenceFlow_1hp2h5t</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1ss02ik</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_0h4378g</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_076ma0v</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1g6azih</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1chnlq6" name="GoTo StartDeleteDevinSDNC"> <bpmn:incoming>SequenceFlow_0h4378g</bpmn:incoming> @@ -91,10 +91,6 @@ dcsi.preProcessRequest(execution)]]></bpmn:script> <bpmn:outgoing>SequenceFlow_0pkp4ce</bpmn:outgoing> </bpmn:callActivity> <bpmn:sequenceFlow id="SequenceFlow_0pkp4ce" sourceRef="CallActivity_0pyrfca" targetRef="ScriptTask_0u1piih" /> - <bpmn:endEvent id="EndEvent_0ymfq61"> - <bpmn:incoming>SequenceFlow_076ma0v</bpmn:incoming> - </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_076ma0v" sourceRef="ExclusiveGateway_0kba700" targetRef="EndEvent_0ymfq61" /> <bpmn:scriptTask id="ScriptTask_02rli65" name="Get VNF ID" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1ss02ik</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0pg3072</bpmn:outgoing> @@ -111,9 +107,47 @@ def dcsi = new DeleteDeviceResource() dcsi.postVNFInfoProcess(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_1ylvnxq" sourceRef="ScriptTask_0u1piih" targetRef="IntermediateThrowEvent_1caax8u" /> + <bpmn:scriptTask id="ScriptTask_14oc86m" name="Prepare Create resource progress" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1g6azih</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_003svcq</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +execution.setVariable("progress", "100") +execution.setVariable("status", "finished") +execution.setVariable("statusDescription", "Finished for the devType") +def dcsi = new DeleteDeviceResource() +dcsi.prepareUpdateProgress(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_1b3omyh" name="resource progress update"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_003svcq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1donwoj</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_003svcq" sourceRef="ScriptTask_14oc86m" targetRef="ServiceTask_1b3omyh" /> + <bpmn:sequenceFlow id="SequenceFlow_1g6azih" sourceRef="ExclusiveGateway_0kba700" targetRef="ScriptTask_14oc86m" /> + <bpmn:endEvent id="EndEvent_1tn8i1e"> + <bpmn:incoming>SequenceFlow_1donwoj</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1donwoj" sourceRef="ServiceTask_1b3omyh" targetRef="EndEvent_1tn8i1e" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteDeviceResource.bpmn"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteDeviceResource"> <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> <dc:Bounds x="1026" y="111" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -158,7 +192,7 @@ dcsi.postVNFInfoProcess(execution)]]></bpmn:script> <bpmndi:BPMNShape id="ExclusiveGateway_0kba700_di" bpmnElement="ExclusiveGateway_0kba700" isMarkerVisible="true"> <dc:Bounds x="334" y="-152" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="309" y="-166" width="34" height="12" /> + <dc:Bounds x="302" y="-166" width="48" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_1chnlq6_di" bpmnElement="IntermediateThrowEvent_1chnlq6"> @@ -228,19 +262,6 @@ dcsi.postVNFInfoProcess(execution)]]></bpmn:script> <dc:Bounds x="760.5" y="-148" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_0ymfq61_di" bpmnElement="EndEvent_0ymfq61"> - <dc:Bounds x="341" y="-251" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="359" y="-211" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_076ma0v_di" bpmnElement="SequenceFlow_076ma0v"> - <di:waypoint xsi:type="dc:Point" x="359" y="-152" /> - <di:waypoint xsi:type="dc:Point" x="359" y="-215" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="374" y="-189.5" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_02rli65_di" bpmnElement="ScriptTask_02rli65"> <dc:Bounds x="480" y="-167" width="100" height="80" /> </bpmndi:BPMNShape> @@ -261,6 +282,39 @@ dcsi.postVNFInfoProcess(execution)]]></bpmn:script> <dc:Bounds x="987.5" y="-148" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_14oc86m_di" bpmnElement="ScriptTask_14oc86m"> + <dc:Bounds x="309" y="-281" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1b3omyh_di" bpmnElement="ServiceTask_1b3omyh"> + <dc:Bounds x="480" y="-281" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_003svcq_di" bpmnElement="SequenceFlow_003svcq"> + <di:waypoint xsi:type="dc:Point" x="409" y="-241" /> + <di:waypoint xsi:type="dc:Point" x="480" y="-241" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="444.5" y="-262" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1g6azih_di" bpmnElement="SequenceFlow_1g6azih"> + <di:waypoint xsi:type="dc:Point" x="359" y="-152" /> + <di:waypoint xsi:type="dc:Point" x="359" y="-201" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="374" y="-182.5" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_1tn8i1e_di" bpmnElement="EndEvent_1tn8i1e"> + <dc:Bounds x="663" y="-259" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="681" y="-219" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1donwoj_di" bpmnElement="SequenceFlow_1donwoj"> + <di:waypoint xsi:type="dc:Point" x="580" y="-241" /> + <di:waypoint xsi:type="dc:Point" x="663" y="-241" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="621.5" y="-262" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn index 00c0288246..da17fee16e 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn @@ -1,78 +1,56 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.16.2"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.0"> <bpmn:process id="DeleteSDNCNetworkResource" name="DeleteSDNCNetworkResource" isExecutable="true"> - <bpmn:startEvent id="deleteNetworkResource_StartEvent" name="deleteNetworkResource_StartEvent"> - <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> + <bpmn:startEvent id="deleteNetworkResource_StartEvent_delete" name="deleteNetworkResource_StartEvent"> + <bpmn:outgoing>SequenceFlow_1qo2pln_delete</bpmn:outgoing> </bpmn:startEvent> - <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="deleteNetworkResource_StartEvent" targetRef="Task_1dlrfiw" /> - <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="Task_0tezqd4" /> - <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="prepare SDNC Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0jh88qw</bpmn:incoming> - <bpmn:incoming>SequenceFlow_00vqgvt</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* + <bpmn:sequenceFlow id="SequenceFlow_1qo2pln_delete" sourceRef="deleteNetworkResource_StartEvent_delete" targetRef="Task_1dlrfiw_delete" /> + <bpmn:sequenceFlow id="SequenceFlow_0khtova_delete" sourceRef="PreprocessIncomingRequest_task_delete" targetRef="Task_0tfzqd4_delete" /> + <bpmn:scriptTask id="PreprocessIncomingRequest_task_delete" name="prepare SDNC Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0jh88qw_delete</bpmn:incoming> + <bpmn:incoming>SequenceFlow_00vqgvt_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0khtova_delete</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DeleteSDNCNetworkResource() dcsi.prepareSDNCRequest(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:endEvent id="EndEvent_1x6k78c" name="delete SDNC call end"> - <bpmn:incoming>SequenceFlow_15wux6a</bpmn:incoming> + <bpmn:endEvent id="EndEvent_1x6k78c_delete" name="delete SDNC call end"> + <bpmn:incoming>SequenceFlow_15wux6a_delete</bpmn:incoming> </bpmn:endEvent> - <bpmn:callActivity id="CallActivity_1600xlj" name="Call SDNC RSRC Adapter V1 " calledElement="sdncAdapter"> - <bpmn:extensionElements> - <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> - <camunda:in source="mso-request-id" target="mso-request-id" /> - <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> - <camunda:out source="sdncAdapterResponse" target="DELSDNCRES_activateSDNCResponse" /> - <camunda:out source="SDNCA_ResponseCode" target="DELSDNCRES_sdncDeleteReturnCode" /> - <camunda:out source="SDNCA_SuccessIndicator" target="DELSDNCRES_SuccessIndicator" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_15mvedq</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1xk5xed</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_1xk5xed" sourceRef="CallActivity_1600xlj" targetRef="Task_0uwlr22" /> - <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred" targetRef="ScriptTask_1emjxm2" /> - <bpmn:scriptTask id="Task_023hred" name="post SDNC delete call"> - <bpmn:incoming>SequenceFlow_0ds04u5</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0ow44q0</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* + <bpmn:sequenceFlow id="SequenceFlow_0ow44q0_delete" sourceRef="Task_023hred_delete" targetRef="ScriptTask_1emjxm2_delete" /> + <bpmn:scriptTask id="Task_023hred_delete" name="post SDNC delete call"> + <bpmn:incoming>SequenceFlow_0ds04u5_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ow44q0_delete</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DeleteSDNCNetworkResource() dcsi.postDeleteSDNCCall(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_0w2es8j" sourceRef="Task_1dlrfiw" targetRef="Task_13sx2bp" /> - <bpmn:sequenceFlow id="SequenceFlow_18l3crb" sourceRef="Task_13sx2bp" targetRef="ExclusiveGateway_0xrgeq3" /> - <bpmn:scriptTask id="Task_1dlrfiw" name="Set the Recipe DesignTimeParam" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0w2es8j</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_0w2es8j_delete" sourceRef="Task_1dlrfiw_delete" targetRef="Task_13sx2bp_delete" /> + <bpmn:sequenceFlow id="SequenceFlow_18l3crb_delete" sourceRef="Task_13sx2bp_delete" targetRef="ExclusiveGateway_0xrgeq3_delete" /> + <bpmn:scriptTask id="Task_1dlrfiw_delete" name="Set the Recipe DesignTimeParam" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1qo2pln_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0w2es8j_delete</bpmn:outgoing> <bpmn:script>String recipeParamXsdDemo="""{"operationType":"GRE"}""" String recipeParamXsd="" execution.setVariable("recipeParamXsd", recipeParamXsd)</bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="Task_13sx2bp" name="Pre Process Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0w2es8j</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_18l3crb</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* + <bpmn:scriptTask id="Task_13sx2bp_delete" name="Pre Process Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0w2es8j_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18l3crb_delete</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DeleteSDNCNetworkResource() dcsi.preProcessRequest(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_1mz0vdx" sourceRef="Task_0tezqd4" targetRef="Task_18tomkl" /> - <bpmn:sequenceFlow id="SequenceFlow_15mvedq" sourceRef="Task_18tomkl" targetRef="CallActivity_1600xlj" /> - <bpmn:scriptTask id="Task_0tezqd4" name="Delete progress update parameters before delete" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1mz0vdx</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* + <bpmn:sequenceFlow id="SequenceFlow_1mz0vdx_delete" sourceRef="Task_0tfzqd4_delete" targetRef="Task_18tomkl_delete" /> + <bpmn:sequenceFlow id="SequenceFlow_15mvedq_delete" sourceRef="Task_18tomkl_delete" targetRef="CallActivity_0bj0odq" /> + <bpmn:scriptTask id="Task_0tfzqd4_delete" name="Delete progress update parameters before delete" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0khtova_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1mz0vdx_delete</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DeleteSDNCNetworkResource() dcsi.prepareUpdateBeforeDeleteSDNCResource(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="Task_0uwlr22" name="Create progress update parameters After delete" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1xk5xed</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1jr6zi0</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new DeleteSDNCNetworkResource() -dcsi.prepareUpdateAfterDeleteSDNCResource(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:serviceTask id="Task_18tomkl" name="update progress update"> + <bpmn:serviceTask id="Task_18tomkl_delete" name="update progress update"> <bpmn:extensionElements> <camunda:connector> <camunda:inputOutput> @@ -91,10 +69,10 @@ dcsi.prepareUpdateAfterDeleteSDNCResource(execution)</bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1mz0vdx</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_15mvedq</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_1mz0vdx_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15mvedq_delete</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="ServiceTask_1cm8iwr" name="update progress update"> + <bpmn:serviceTask id="ServiceTask_1cm8iwr_delete" name="update progress update"> <bpmn:extensionElements> <camunda:connector> <camunda:inputOutput> @@ -113,178 +91,181 @@ dcsi.prepareUpdateAfterDeleteSDNCResource(execution)</bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1jr6zi0</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0ds04u5</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_0yooswe_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ds04u5_delete</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_1jr6zi0" sourceRef="Task_0uwlr22" targetRef="ServiceTask_1cm8iwr" /> - <bpmn:scriptTask id="ScriptTask_1emjxm2" name="Send Sync Ack Response" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_15wux6a</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* + <bpmn:scriptTask id="ScriptTask_1emjxm2_delete" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ow44q0_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15wux6a_delete</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi = new DeleteSDNCNetworkResource() csi.sendSyncResponse(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_15wux6a" sourceRef="ScriptTask_1emjxm2" targetRef="EndEvent_1x6k78c" /> - <bpmn:sequenceFlow id="SequenceFlow_0ds04u5" sourceRef="ServiceTask_1cm8iwr" targetRef="Task_023hred" /> - <bpmn:exclusiveGateway id="ExclusiveGateway_0xrgeq3" name="is Deactivate Required"> - <bpmn:incoming>SequenceFlow_18l3crb</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0jh88qw</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0h3klf0</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_15wux6a_delete" sourceRef="ScriptTask_1emjxm2_delete" targetRef="EndEvent_1x6k78c_delete" /> + <bpmn:sequenceFlow id="SequenceFlow_0ds04u5_delete" sourceRef="ServiceTask_1cm8iwr_delete" targetRef="Task_023hred_delete" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_0xrgeq3_delete" name="is Deactivate Required"> + <bpmn:incoming>SequenceFlow_18l3crb_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0jh88qw_delete</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0h3klf0_delete</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_0jh88qw" name="No" sourceRef="ExclusiveGateway_0xrgeq3" targetRef="PreprocessIncomingRequest_task" /> - <bpmn:sequenceFlow id="SequenceFlow_0h3klf0" name="Yes" sourceRef="ExclusiveGateway_0xrgeq3" targetRef="Task_1xychp0"> + <bpmn:sequenceFlow id="SequenceFlow_0jh88qw_delete" name="No" sourceRef="ExclusiveGateway_0xrgeq3_delete" targetRef="PreprocessIncomingRequest_task_delete"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isActivateRequired") != "true")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0h3klf0_delete" name="Yes" sourceRef="ExclusiveGateway_0xrgeq3_delete" targetRef="Task_1xychp0_delete"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isActivateRequired") == "true")}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_00vqgvt" sourceRef="Task_1xychp0" targetRef="PreprocessIncomingRequest_task" /> - <bpmn:callActivity id="Task_1xychp0" name="Call Deactivate SDNC Network Resource" calledElement="DeActivateSDNCNetworkResource"> + <bpmn:sequenceFlow id="SequenceFlow_00vqgvt_delete" sourceRef="Task_1xychp0_delete" targetRef="PreprocessIncomingRequest_task_delete" /> + <bpmn:callActivity id="Task_1xychp0_delete" name="Call Deactivate SDNC Network Resource" calledElement="DeActivateSDNCNetworkResource"> <bpmn:extensionElements> <camunda:in source="mso-request-id" target="mso-request-id" /> <camunda:in source="requestAction" target="requestAction" /> <camunda:in source="recipeParams" target="recipeParams" /> - <camunda:in source="recipeParams" target="recipeParams" /> <camunda:in source="recipeParamXsd" target="recipeParamXsd" /> <camunda:in source="URN_mso_workflow_sdncadapter_callback" target="URN_mso_workflow_sdncadapter_callback" /> <camunda:in source="resourceInput" target="resourceInput" /> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0h3klf0</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_00vqgvt</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_0h3klf0_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_00vqgvt_delete</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="Task_1ikbt2h_delete" name="Create progress update parameters After delete" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0lplazm</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0yooswe_delete</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DeleteSDNCNetworkResource() +dcsi.prepareUpdateAfterDeleteSDNCResource(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0yooswe_delete" sourceRef="Task_1ikbt2h_delete" targetRef="ServiceTask_1cm8iwr_delete" /> + <bpmn:callActivity id="CallActivity_0bj0odq" name="Call SDNC RSRC Adapter V1 " calledElement="sdncAdapter"> + <bpmn:extensionElements> + <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="sdncAdapterResponse" target="DELSDNCRES_activateSDNCResponse" /> + <camunda:out source="SDNCA_ResponseCode" target="DELSDNCRES_sdncDeleteReturnCode" /> + <camunda:out source="SDNCA_SuccessIndicator" target="DELSDNCRES_SuccessIndicator" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_15mvedq_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0lplazm</bpmn:outgoing> </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0lplazm" sourceRef="CallActivity_0bj0odq" targetRef="Task_1ikbt2h_delete" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteSDNCNetworkResource"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="deleteNetworkResource_StartEvent"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="deleteNetworkResource_StartEvent_delete"> <dc:Bounds x="-111" y="111" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-136" y="147" width="89" height="28" /> + <dc:Bounds x="-135" y="147" width="88" height="40" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> + <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln_delete"> <di:waypoint x="-75" y="129" /> <di:waypoint x="-10" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="-87.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> + <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova_delete"> <di:waypoint x="593" y="129" /> <di:waypoint x="684" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="391.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> + <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task_delete"> <dc:Bounds x="493" y="89" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> + <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c_delete"> <dc:Bounds x="898" y="317" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="862" y="359" width="84" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_1600xlj_di" bpmnElement="CallActivity_1600xlj"> - <dc:Bounds x="42" y="295" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1xk5xed_di" bpmnElement="SequenceFlow_1xk5xed"> - <di:waypoint x="142" y="335" /> - <di:waypoint x="200" y="335" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="210.5" y="314" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0"> + <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0_delete"> <di:waypoint x="624" y="335" /> <di:waypoint x="709" y="335" /> <bpmndi:BPMNLabel> <dc:Bounds x="719" y="314" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred"> + <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred_delete"> <dc:Bounds x="524" y="295" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0w2es8j_di" bpmnElement="SequenceFlow_0w2es8j"> + <bpmndi:BPMNEdge id="SequenceFlow_0w2es8j_di" bpmnElement="SequenceFlow_0w2es8j_delete"> <di:waypoint x="90" y="129" /> <di:waypoint x="148" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="74" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb"> + <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb_delete"> <di:waypoint x="248" y="129" /> <di:waypoint x="325" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="235.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0lc6l7a_di" bpmnElement="Task_1dlrfiw"> + <bpmndi:BPMNShape id="ScriptTask_0lc6l7a_di" bpmnElement="Task_1dlrfiw_delete"> <dc:Bounds x="-10" y="89" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp"> + <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp_delete"> <dc:Bounds x="148" y="89" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1mz0vdx_di" bpmnElement="SequenceFlow_1mz0vdx"> + <bpmndi:BPMNEdge id="SequenceFlow_1mz0vdx_di" bpmnElement="SequenceFlow_1mz0vdx_delete"> <di:waypoint x="784" y="129" /> <di:waypoint x="900" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="608" y="123" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_15mvedq_di" bpmnElement="SequenceFlow_15mvedq"> + <bpmndi:BPMNEdge id="SequenceFlow_15mvedq_di" bpmnElement="SequenceFlow_15mvedq_delete"> <di:waypoint x="950" y="169" /> - <di:waypoint x="950" y="218" /> - <di:waypoint x="0" y="218" /> - <di:waypoint x="0" y="335" /> - <di:waypoint x="42" y="335" /> + <di:waypoint x="950" y="246" /> + <di:waypoint x="-106" y="246" /> + <di:waypoint x="-106" y="335" /> + <di:waypoint x="9" y="335" /> <bpmndi:BPMNLabel> <dc:Bounds x="349" y="197" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1kqf4ge_di" bpmnElement="Task_0tezqd4"> + <bpmndi:BPMNShape id="ScriptTask_1kqf4ge_di" bpmnElement="Task_0tfzqd4_delete"> <dc:Bounds x="684" y="89" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0hu4lhm_di" bpmnElement="Task_0uwlr22"> - <dc:Bounds x="200" y="295" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1q6ssz7_di" bpmnElement="Task_18tomkl"> + <bpmndi:BPMNShape id="ServiceTask_1q6ssz7_di" bpmnElement="Task_18tomkl_delete"> <dc:Bounds x="900" y="89" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1cm8iwr_di" bpmnElement="ServiceTask_1cm8iwr"> + <bpmndi:BPMNShape id="ServiceTask_1cm8iwr_di" bpmnElement="ServiceTask_1cm8iwr_delete"> <dc:Bounds x="355" y="295" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1jr6zi0_di" bpmnElement="SequenceFlow_1jr6zi0"> - <di:waypoint x="300" y="335" /> - <di:waypoint x="355" y="335" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="444.5" y="314" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1emjxm2_di" bpmnElement="ScriptTask_1emjxm2"> + <bpmndi:BPMNShape id="ScriptTask_1emjxm2_di" bpmnElement="ScriptTask_1emjxm2_delete"> <dc:Bounds x="709" y="295" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_15wux6a_di" bpmnElement="SequenceFlow_15wux6a"> + <bpmndi:BPMNEdge id="SequenceFlow_15wux6a_di" bpmnElement="SequenceFlow_15wux6a_delete"> <di:waypoint x="809" y="335" /> <di:waypoint x="898" y="335" /> <bpmndi:BPMNLabel> <dc:Bounds x="930" y="313" width="0" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0ds04u5_di" bpmnElement="SequenceFlow_0ds04u5"> + <bpmndi:BPMNEdge id="SequenceFlow_0ds04u5_di" bpmnElement="SequenceFlow_0ds04u5_delete"> <di:waypoint x="455" y="335" /> <di:waypoint x="524" y="335" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_0xrgeq3_di" bpmnElement="ExclusiveGateway_0xrgeq3" isMarkerVisible="true"> + <bpmndi:BPMNShape id="ExclusiveGateway_0xrgeq3_di" bpmnElement="ExclusiveGateway_0xrgeq3_delete" isMarkerVisible="true"> <dc:Bounds x="325" y="104" width="50" height="50" /> <bpmndi:BPMNLabel> <dc:Bounds x="320" y="161" width="63" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0jh88qw_di" bpmnElement="SequenceFlow_0jh88qw"> + <bpmndi:BPMNEdge id="SequenceFlow_0jh88qw_di" bpmnElement="SequenceFlow_0jh88qw_delete"> <di:waypoint x="375" y="129" /> <di:waypoint x="493" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="427" y="111" width="14" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0h3klf0_di" bpmnElement="SequenceFlow_0h3klf0"> + <bpmndi:BPMNEdge id="SequenceFlow_0h3klf0_di" bpmnElement="SequenceFlow_0h3klf0_delete"> <di:waypoint x="350" y="104" /> <di:waypoint x="350" y="-12" /> <di:waypoint x="493" y="-12" /> @@ -292,13 +273,27 @@ csi.sendSyncResponse(execution)</bpmn:script> <dc:Bounds x="356" y="43" width="19" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_00vqgvt_di" bpmnElement="SequenceFlow_00vqgvt"> + <bpmndi:BPMNEdge id="SequenceFlow_00vqgvt_di" bpmnElement="SequenceFlow_00vqgvt_delete"> <di:waypoint x="543" y="28" /> <di:waypoint x="543" y="89" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_1lddjec_di" bpmnElement="Task_1xychp0"> + <bpmndi:BPMNShape id="CallActivity_1lddjec_di" bpmnElement="Task_1xychp0_delete"> <dc:Bounds x="493" y="-52" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1wj862v_di" bpmnElement="Task_1ikbt2h_delete"> + <dc:Bounds x="205" y="295" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0yooswe_di" bpmnElement="SequenceFlow_0yooswe_delete"> + <di:waypoint x="305" y="335" /> + <di:waypoint x="355" y="335" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0bj0odq_di" bpmnElement="CallActivity_0bj0odq"> + <dc:Bounds x="9" y="295" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0lplazm_di" bpmnElement="SequenceFlow_0lplazm"> + <di:waypoint x="109" y="335" /> + <di:waypoint x="205" y="335" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions> +</bpmn:definitions>
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn index 0dc570771d..9cf21ddc52 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn @@ -76,7 +76,7 @@ ddsi.postProcessAAIPUT(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1qctzm0" sourceRef="Task_0uiekmn" targetRef="Task_0raqlqc" /> <bpmn2:scriptTask id="Task_0uiekmn" name="Prepare Resource Oper Status" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1hbesp9</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1e5j351</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1qctzm0</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoCreateE2EServiceInstance() @@ -102,7 +102,7 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script> </camunda:connector> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_1qctzm0</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0bfwj4y</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_1s5aas9</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0bq4fxs" name="Go to Decompose_Service"> <bpmn2:incoming>SequenceFlow_0w9t6tc</bpmn2:incoming> @@ -147,10 +147,10 @@ dcsi.prepareDecomposeService(execution)]]></bpmn2:script> <bpmn2:sequenceFlow id="SequenceFlow_1qiiycn" sourceRef="createSI_startEvent" targetRef="preProcessRequest_ScriptTask" /> <bpmn2:sequenceFlow id="SequenceFlow_166w91p" sourceRef="IntermediateCatchEvent_0tv85pg" targetRef="ScriptTask_1cllqk3" /> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_16okck2" name="GoTo StartPrepareResource"> - <bpmn2:incoming>SequenceFlow_15d8lqu</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1tkgqu3</bpmn2:incoming> <bpmn2:linkEventDefinition name="StartPrepareResource" /> </bpmn2:intermediateThrowEvent> - <bpmn2:sequenceFlow id="SequenceFlow_1tkgqu3" sourceRef="ScriptTask_0q37vn9" targetRef="ScriptTask_08yiqtu" /> + <bpmn2:sequenceFlow id="SequenceFlow_1tkgqu3" sourceRef="ScriptTask_0q37vn9" targetRef="IntermediateThrowEvent_16okck2" /> <bpmn2:sequenceFlow id="SequenceFlow_0w9t6tc" sourceRef="preProcessRequest_ScriptTask" targetRef="IntermediateThrowEvent_0bq4fxs" /> <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_0jrb3xu" name="StartService"> <bpmn2:outgoing>SequenceFlow_1i7t9hq</bpmn2:outgoing> @@ -161,7 +161,7 @@ dcsi.prepareDecomposeService(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_1hbesp9</bpmn2:outgoing> <bpmn2:linkEventDefinition name="StartPrepareResource" /> </bpmn2:intermediateCatchEvent> - <bpmn2:sequenceFlow id="SequenceFlow_1hbesp9" sourceRef="IntermediateCatchEvent_05dus9b" targetRef="Task_0uiekmn" /> + <bpmn2:sequenceFlow id="SequenceFlow_1hbesp9" sourceRef="IntermediateCatchEvent_05dus9b" targetRef="ScriptTask_0dpt36a" /> <bpmn2:callActivity id="CallActivity_1ojtwas" name="Call DoCreateResources" calledElement="DoCreateResourcesV3"> <bpmn2:extensionElements> <camunda:in source="nsServiceName" target="nsServiceName" /> @@ -205,30 +205,22 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script> <bpmn2:sequenceFlow id="SequenceFlow_0a6vgsu" sourceRef="ScriptTask_1y7jr4t" targetRef="EndEvent_0hzmoug" /> <bpmn2:sequenceFlow id="SequenceFlow_012h7yx" sourceRef="ScriptTask_1o01d7d" targetRef="IntermediateThrowEvent_1mlbhmt" /> <bpmn2:scriptTask id="ScriptTask_0dpt36a" name="Process Site Location" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_0bfwj4y</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1e5vxox</bpmn2:outgoing> + <bpmn2:incoming>SequenceFlow_1hbesp9</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1e5j351</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def dcsi= new DoCreateE2EServiceInstance() dcsi.doProcessSiteLocation(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="ScriptTask_1a5mdd6" name="Process Link TP Resource Allocation" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1e5vxox</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1s5aas9</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0p6ba92</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def dcsi= new DoCreateE2EServiceInstance() dcsi.doTPResourcesAllocation(execution)]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1e5vxox" sourceRef="ScriptTask_0dpt36a" targetRef="ScriptTask_1a5mdd6" /> - <bpmn2:sequenceFlow id="SequenceFlow_0bfwj4y" sourceRef="Task_0raqlqc" targetRef="ScriptTask_0dpt36a" /> <bpmn2:sequenceFlow id="SequenceFlow_0p6ba92" sourceRef="ScriptTask_1a5mdd6" targetRef="ScriptTask_04b21gb" /> - <bpmn2:scriptTask id="ScriptTask_08yiqtu" name="Store ServiceInput to AAI" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1tkgqu3</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_15d8lqu</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def ddsi = new DoCreateE2EServiceInstance() -ddsi.saveServiceInputToAAI(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_15d8lqu" sourceRef="ScriptTask_08yiqtu" targetRef="IntermediateThrowEvent_16okck2" /> + <bpmn2:sequenceFlow id="SequenceFlow_1s5aas9" sourceRef="Task_0raqlqc" targetRef="ScriptTask_1a5mdd6" /> + <bpmn2:sequenceFlow id="SequenceFlow_1e5j351" sourceRef="ScriptTask_0dpt36a" targetRef="Task_0uiekmn" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -311,17 +303,17 @@ ddsi.saveServiceInputToAAI(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1qctzm0_di" bpmnElement="SequenceFlow_1qctzm0"> - <di:waypoint xsi:type="dc:Point" x="226" y="300" /> - <di:waypoint xsi:type="dc:Point" x="297" y="300" /> + <di:waypoint xsi:type="dc:Point" x="376" y="300" /> + <di:waypoint xsi:type="dc:Point" x="447" y="300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="216.5" y="279" width="90" height="12" /> + <dc:Bounds x="367" y="279" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0v81r5h_di" bpmnElement="Task_0uiekmn"> - <dc:Bounds x="126" y="260" width="100" height="80" /> + <dc:Bounds x="276" y="260" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_14tnuxf_di" bpmnElement="Task_0raqlqc"> - <dc:Bounds x="297" y="260" width="100" height="80" /> + <dc:Bounds x="447" y="260" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_11saqvj_di" bpmnElement="IntermediateThrowEvent_0bq4fxs"> <dc:Bounds x="1315" y="-207" width="36" height="36" /> @@ -386,9 +378,9 @@ ddsi.saveServiceInputToAAI(execution)]]></bpmn2:script> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1tkgqu3_di" bpmnElement="SequenceFlow_1tkgqu3"> <di:waypoint xsi:type="dc:Point" x="813" y="94" /> - <di:waypoint xsi:type="dc:Point" x="991" y="94" /> + <di:waypoint xsi:type="dc:Point" x="1315" y="94" /> <bpmndi:BPMNLabel> - <dc:Bounds x="857" y="73" width="90" height="12" /> + <dc:Bounds x="1019" y="73" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0w9t6tc_di" bpmnElement="SequenceFlow_0w9t6tc"> @@ -423,9 +415,9 @@ ddsi.saveServiceInputToAAI(execution)]]></bpmn2:script> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1hbesp9_di" bpmnElement="SequenceFlow_1hbesp9"> <di:waypoint xsi:type="dc:Point" x="54" y="300" /> - <di:waypoint xsi:type="dc:Point" x="126" y="300" /> + <di:waypoint xsi:type="dc:Point" x="102" y="300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="45" y="279" width="90" height="12" /> + <dc:Bounds x="33" y="279" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_1ojtwas_di" bpmnElement="CallActivity_1ojtwas"> @@ -472,25 +464,11 @@ ddsi.saveServiceInputToAAI(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0dpt36a_di" bpmnElement="ScriptTask_0dpt36a"> - <dc:Bounds x="455" y="260" width="100" height="80" /> + <dc:Bounds x="102" y="260" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1a5mdd6_di" bpmnElement="ScriptTask_1a5mdd6"> <dc:Bounds x="613" y="260" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1e5vxox_di" bpmnElement="SequenceFlow_1e5vxox"> - <di:waypoint xsi:type="dc:Point" x="555" y="300" /> - <di:waypoint xsi:type="dc:Point" x="613" y="300" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="539" y="279" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0bfwj4y_di" bpmnElement="SequenceFlow_0bfwj4y"> - <di:waypoint xsi:type="dc:Point" x="397" y="300" /> - <di:waypoint xsi:type="dc:Point" x="455" y="300" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="426" y="279" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0p6ba92_di" bpmnElement="SequenceFlow_0p6ba92"> <di:waypoint xsi:type="dc:Point" x="713" y="300" /> <di:waypoint xsi:type="dc:Point" x="799" y="300" /> @@ -498,14 +476,18 @@ ddsi.saveServiceInputToAAI(execution)]]></bpmn2:script> <dc:Bounds x="756" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_08yiqtu_di" bpmnElement="ScriptTask_08yiqtu"> - <dc:Bounds x="991" y="54" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_15d8lqu_di" bpmnElement="SequenceFlow_15d8lqu"> - <di:waypoint xsi:type="dc:Point" x="1091" y="94" /> - <di:waypoint xsi:type="dc:Point" x="1315" y="94" /> + <bpmndi:BPMNEdge id="SequenceFlow_1s5aas9_di" bpmnElement="SequenceFlow_1s5aas9"> + <di:waypoint xsi:type="dc:Point" x="547" y="300" /> + <di:waypoint xsi:type="dc:Point" x="613" y="300" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="580" y="279" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1e5j351_di" bpmnElement="SequenceFlow_1e5j351"> + <di:waypoint xsi:type="dc:Point" x="202" y="300" /> + <di:waypoint xsi:type="dc:Point" x="276" y="300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1203" y="73" width="0" height="12" /> + <dc:Bounds x="239" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java new file mode 100644 index 0000000000..94eead2d05 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java @@ -0,0 +1,144 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.activity; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables; +import org.camunda.bpm.engine.variable.VariableMap; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.onap.so.serviceinstancebeans.RequestDetails; +import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.databind.ObjectMapper; + +@Component("ExecuteActivity") +public class ExecuteActivity implements JavaDelegate { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExecuteActivity.class); + private static final String G_BPMN_REQUEST = "bpmnRequest"; + private static final String VNF_TYPE = "vnfType"; + private static final String G_ACTION = "requestAction"; + private static final String G_REQUEST_ID = "mso-request-id"; + private static final String VNF_ID = "vnfId"; + private static final String SERVICE_INSTANCE_ID = "serviceInstanceId"; + + private static final String SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE = "implementation"; + private static final String ACTIVITY_PREFIX = "activity:"; + + private ObjectMapper mapper = new ObjectMapper(); + + @Autowired + private RuntimeService runtimeService; + @Autowired + private ExceptionBuilder exceptionBuilder; + + @Override + public void execute(DelegateExecution execution) throws Exception { + final String requestId = (String) execution.getVariable(G_REQUEST_ID); + + try { + final String implementationString = execution.getBpmnModelElementInstance().getAttributeValue(SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE); + msoLogger.debug("activity implementation String: " + implementationString); + if (!implementationString.startsWith(ACTIVITY_PREFIX)) { + buildAndThrowException(execution, "Implementation attribute has a wrong format"); + } + String activityName = implementationString.replaceFirst(ACTIVITY_PREFIX, ""); + msoLogger.info("activityName is: " + activityName); + + BuildingBlock buildingBlock = buildBuildingBlock(activityName); + ExecuteBuildingBlock executeBuildingBlock = buildExecuteBuildingBlock(execution, requestId, buildingBlock); + + Map<String, Object> variables = new HashMap<>(); + variables.put("buildingBlock", executeBuildingBlock); + variables.put("mso-request-id", requestId); + variables.put("retryCount", 1); + + ProcessInstanceWithVariables buildingBlockResult = runtimeService.createProcessInstanceByKey("ExecuteBuildingBlock").setVariables(variables).executeWithVariablesInReturn(); + VariableMap variableMap = buildingBlockResult.getVariables(); + + WorkflowException workflowException = (WorkflowException) variableMap.get("WorklfowException"); + if (workflowException != null) { + msoLogger.error("Workflow exception is: " + workflowException.getErrorMessage()); + } + execution.setVariable("WorkflowException", workflowException); + } + catch (Exception e) { + buildAndThrowException(execution, e.getMessage()); + } + } + + protected BuildingBlock buildBuildingBlock(String activityName) { + BuildingBlock buildingBlock = new BuildingBlock(); + buildingBlock.setBpmnFlowName(activityName); + buildingBlock.setMsoId(UUID.randomUUID().toString()); + buildingBlock.setKey(""); + buildingBlock.setIsVirtualLink(false); + buildingBlock.setVirtualLinkKey(""); + return buildingBlock; + } + + protected ExecuteBuildingBlock buildExecuteBuildingBlock(DelegateExecution execution, String requestId, + BuildingBlock buildingBlock) throws Exception { + ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock(); + String bpmnRequest = (String) execution.getVariable(G_BPMN_REQUEST); + ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class); + RequestDetails requestDetails = sIRequest.getRequestDetails(); + executeBuildingBlock.setaLaCarte(true); + executeBuildingBlock.setRequestAction((String) execution.getVariable(G_ACTION)); + executeBuildingBlock.setResourceId((String) execution.getVariable(VNF_ID)); + executeBuildingBlock.setVnfType((String) execution.getVariable(VNF_TYPE)); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId((String) execution.getVariable(SERVICE_INSTANCE_ID)); + workflowResourceIds.setVnfId((String) execution.getVariable(VNF_ID)); + executeBuildingBlock.setWorkflowResourceIds(workflowResourceIds); + executeBuildingBlock.setRequestId(requestId); + executeBuildingBlock.setBuildingBlock(buildingBlock); + executeBuildingBlock.setRequestDetails(requestDetails); + return executeBuildingBlock; + } + + protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, msg, ex); + execution.setVariable("ExecuteActivityErrorMessage", msg); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); + } + + protected void buildAndThrowException(DelegateExecution execution, String msg) { + msoLogger.error(msg); + execution.setVariable("ExecuteActuvityErrorMessage", msg); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java new file mode 100644 index 0000000000..798837fa7d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java @@ -0,0 +1,171 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.appc.tasks; + +import java.util.HashMap; +import java.util.List; +import java.util.Optional; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.db.catalog.beans.ControllerSelectionReference; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.appc.client.lcm.model.Action; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.client.appc.ApplicationControllerAction; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AppcRunTasks { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AppcRunTasks.class); + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private CatalogDbClient catalogDbClient; + @Autowired + private ApplicationControllerAction appCClient; + + public void preProcessActivity(BuildingBlockExecution execution) { + execution.setVariable("actionSnapshot", Action.Snapshot); + execution.setVariable("actionLock", Action.Lock); + execution.setVariable("actionUnlock", Action.Unlock); + execution.setVariable("actionUpgradePreCheck", Action.UpgradePreCheck); + execution.setVariable("actionUpgradePostCheck", Action.UpgradePostCheck); + execution.setVariable("actionQuiesceTraffic", Action.QuiesceTraffic); + execution.setVariable("actionUpgradeBackup", Action.UpgradeBackup); + execution.setVariable("actionUpgradeSoftware", Action.UpgradeSoftware); + execution.setVariable("actionResumeTraffic", Action.ResumeTraffic); + execution.setVariable("actionStop", Action.Stop); + execution.setVariable("actionStart", Action.Start); + execution.setVariable("rollbackVnfStop", false); + execution.setVariable("rollbackVnfLock", false); + execution.setVariable("rollbackQuiesceTraffic", false); + } + + public void runAppcCommand(BuildingBlockExecution execution, Action action) { + msoLogger.trace("Start runAppcCommand "); + String appcCode = "1002"; + String appcMessage = ""; + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + GenericVnf vnf = null; + try { + vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + } catch (BBObjectNotFoundException e) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "No valid VNF exists"); + } + String vnfId = vnf.getVnfId(); + String msoRequestId = gBBInput.getRequestContext().getMsoRequestId(); + String vnfName = vnf.getVnfName(); + String vnfType = vnf.getVnfType(); + + String aicIdentity = execution.getVariable("aicIdentity"); + String vnfHostIpAddress = vnf.getIpv4OamAddress(); + String vmIdList = execution.getVariable("vmIdList"); + String vserverIdList = execution.getVariable("vserverIdList"); + String identityUrl = execution.getVariable("identityUrl"); + + ControllerSelectionReference controllerSelectionReference = catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, action.toString()); + String controllerType = controllerSelectionReference.getControllerName(); + + String vfModuleId = null; + VfModule vfModule = null; + try { + vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + } catch (BBObjectNotFoundException e) { + } + if (vfModule != null) { + vfModuleId = vfModule.getVfModuleId(); + } + + HashMap<String, String> payloadInfo = buildPayloadInfo(vnfName, aicIdentity, vnfHostIpAddress, vmIdList, vserverIdList, + identityUrl, vfModuleId); + Optional<String> payload = null; + RequestParameters requestParameters = gBBInput.getRequestContext().getRequestParameters(); + if(requestParameters != null){ + String pay = requestParameters.getPayload(); + if (pay != null) { + payload = Optional.of(pay); + } + } + msoLogger.debug("Running APP-C action: " + action.toString()); + msoLogger.debug("VNFID: " + vnfId); + appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + appcCode = appCClient.getErrorCode(); + appcMessage = appCClient.getErrorMessage(); + mapRollbackVariables(execution, action, appcCode); + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "Caught exception in runAppcCommand", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "APPC Error", e); + appcMessage = e.getMessage(); + } + + msoLogger.error("Error Message: " + appcMessage); + msoLogger.error("ERROR CODE: " + appcCode); + msoLogger.trace("End of runAppCommand "); + if (appcCode != null && !appcCode.equals("0")) { + exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); + } + } + + protected void mapRollbackVariables(BuildingBlockExecution execution, Action action, String appcCode) { + if (appcCode.equals("0") && action != null) { + if (action.equals(Action.Lock)) { + execution.setVariable("rollbackVnfLock", true); + } else if (action.equals(Action.Unlock)) { + execution.setVariable("rollbackVnfLock", false); + } else if (action.equals(Action.Start)) { + execution.setVariable("rollbackVnfStop", false); + } else if (action.equals(Action.Stop)) { + execution.setVariable("rollbackVnfStop", true); + } else if (action.equals(Action.QuiesceTraffic)) { + execution.setVariable("rollbackQuiesceTraffic", true); + } else if (action.equals(Action.ResumeTraffic)) { + execution.setVariable("rollbackQuiesceTraffic", false); + } + } + } + + private HashMap<String,String> buildPayloadInfo(String vnfName, String aicIdentity, String vnfHostIpAddress, + String vmIdList, String vserverIdList, String identityUrl, String vfModuleId) { + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + payloadInfo.put("vnfName", vnfName); + payloadInfo.put("aicIdentity", aicIdentity); + payloadInfo.put("vnfHostIpAddress", vnfHostIpAddress); + payloadInfo.put("vmIdList", vmIdList); + payloadInfo.put("vserverIdList", vserverIdList); + payloadInfo.put("identityUrl", identityUrl); + payloadInfo.put("vfModuleId",vfModuleId); + return payloadInfo; + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java new file mode 100644 index 0000000000..ec2ccdf202 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.tasks; + +import java.util.ArrayList; +import java.util.List; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse; +import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.db.request.client.RequestsDbClient; +import org.onap.so.serviceinstancebeans.RequestReferences; +import org.onap.so.serviceinstancebeans.ServiceInstancesResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Component +public class FlowCompletionTasks { + + private static final Logger logger = LoggerFactory.getLogger(FlowCompletionTasks.class); + + @Autowired + private RequestsDbClient requestDbclient; + + public void updateRequestDbStatus(BuildingBlockExecution execution) { + try { + String requestId = execution.getGeneralBuildingBlock().getRequestContext().getMsoRequestId(); + InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); + + WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException"); + if (workflowException == null) { + request.setStatusMessage("RequestCompletedSuccessfully"); + request.setRequestStatus("COMPLETE"); + + } + else { + request.setStatusMessage(workflowException.getErrorMessage()); + request.setRequestStatus("FAILED"); + } + request.setProgress(100L); + request.setLastModifiedBy("CamundaBPMN"); + + requestDbclient.updateInfraActiveRequests(request); + } catch (Exception e) { + logger.error("Unable to save the updated request status to the DB",e); + } + } + + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index a998f6934f..2d5638c2b7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -35,6 +35,7 @@ import java.util.stream.Collectors; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.javatuples.Pair; +import org.slf4j.LoggerFactory; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.L3Network; import org.onap.aai.domain.yang.Relationship; @@ -61,8 +62,6 @@ import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import org.onap.so.db.catalog.client.CatalogDbClient; -import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; import org.onap.so.serviceinstancebeans.Networks; @@ -71,6 +70,7 @@ import org.onap.so.serviceinstancebeans.Service; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; import org.onap.so.serviceinstancebeans.VfModules; import org.onap.so.serviceinstancebeans.Vnfs; +import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -79,6 +79,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; @Component public class WorkflowAction { + private static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage"; + private static final String SERVICE_INSTANCES = "serviceInstances"; + private static final String WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI = "WorkflowAction was unable to verify if the instance name already exist in AAI."; private static final String G_ORCHESTRATION_FLOW = "gOrchestrationFlow"; private static final String G_ACTION = "requestAction"; private static final String G_CURRENT_SEQUENCE = "gCurrentSequence"; @@ -100,7 +103,8 @@ public class WorkflowAction { private static final String CREATEINSTANCE = "createInstance"; private static final String USERPARAMSERVICE = "service"; private static final String supportedTypes = "vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances"; - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowAction.class); + private static final String HOMINGSOLUTION = "Homing_Solution"; + private static final Logger logger = LoggerFactory.getLogger(WorkflowAction.class); @Autowired protected BBInputSetup bbInputSetup; @@ -157,6 +161,18 @@ public class WorkflowAction { execution.setVariable("resourceId", resourceId); execution.setVariable("resourceType", resourceType); + if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) { + List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters() + .getUserParams(); + for (Map<String, Object> params : userParams) { + if (params.containsKey(HOMINGSOLUTION)) { + execution.setVariable("homing", true); + execution.setVariable("callHoming", true); + execution.setVariable("homingSolution", params.get(HOMINGSOLUTION)); + } + } + } + if (aLaCarte) { if (orchFlows == null || orchFlows.isEmpty()) { orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte); @@ -239,7 +255,7 @@ public class WorkflowAction { for(WorkflowType type : WorkflowType.values()){ foundObjects = foundObjects + type + " - " + resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()).size() + " "; } - msoLogger.info("Found " + foundObjects); + logger.info("Found {}", foundObjects); if (orchFlows == null || orchFlows.isEmpty()) { orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte); @@ -247,7 +263,7 @@ public class WorkflowAction { flowsToExecute = buildExecuteBuildingBlockList(orchFlows, resourceCounter, requestId, apiVersion, resourceId, resourceType, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails); if (!resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()).collect(Collectors.toList()).isEmpty()) { - msoLogger.info("Sorting for Vlan Tagging"); + logger.info("Sorting for Vlan Tagging"); flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction); } if (resourceType == WorkflowType.SERVICE @@ -267,9 +283,9 @@ public class WorkflowAction { throw new IllegalStateException("Macro did not come up with a valid execution path."); } - msoLogger.info("List of BuildingBlocks to execute:"); + logger.info("List of BuildingBlocks to execute:"); for (ExecuteBuildingBlock ebb : flowsToExecute) { - msoLogger.info(ebb.getBuildingBlock().getBpmnFlowName()); + logger.info(ebb.getBuildingBlock().getBpmnFlowName()); } execution.setVariable(G_CURRENT_SEQUENCE, 0); @@ -296,7 +312,7 @@ public class WorkflowAction { private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds) { for(Pair<WorkflowType,String> pair : aaiResourceIds){ - msoLogger.debug(pair.getValue0() + ", " + pair.getValue1()); + logger.debug(pair.getValue0() + ", " + pair.getValue1()); } Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> { @@ -389,12 +405,12 @@ public class WorkflowAction { if (service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty()) { List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations(); if(customizations.isEmpty()) { - msoLogger.debug("No Collections found. CollectionResourceCustomization list is empty."); + logger.debug("No Collections found. CollectionResourceCustomization list is empty."); }else{ CollectionResourceCustomization collectionResourceCustomization = findCatalogNetworkCollection(execution, service); if(collectionResourceCustomization!=null){ resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,collectionResourceCustomization.getModelCustomizationUUID(),false)); - msoLogger.debug("Found a network collection"); + logger.debug("Found a network collection"); if(collectionResourceCustomization.getCollectionResource()!=null){ if(collectionResourceCustomization.getCollectionResource().getInstanceGroup() != null){ String toscaNodeType = collectionResourceCustomization.getCollectionResource().getInstanceGroup().getToscaNodeType(); @@ -413,7 +429,7 @@ public class WorkflowAction { minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity(); } } - msoLogger.debug("minNetworks: " + minNetworks); + logger.debug("minNetworks: {}" , minNetworks); CollectionNetworkResourceCustomization collectionNetworkResourceCust = null; for(CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup.getCollectionNetworkResourceCustomizations()) { if(collectionNetworkTemp.getNetworkResourceCustomization().getModelCustomizationUUID().equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) { @@ -429,21 +445,21 @@ public class WorkflowAction { } } } else { - msoLogger.debug("Instance Group tosca node type does not contain NetworkCollection: " + toscaNodeType); + logger.debug("Instance Group tosca node type does not contain NetworkCollection: {}" , toscaNodeType); } }else{ - msoLogger.debug("No Instance Group found for network collection."); + logger.debug("No Instance Group found for network collection."); } }else{ - msoLogger.debug("No Network Collection found. collectionResource is null"); + logger.debug("No Network Collection found. collectionResource is null"); } } else { - msoLogger.debug("No Network Collection Customization found"); + logger.debug("No Network Collection Customization found"); } } if (resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()).collect(Collectors.toList()).isEmpty()) { if (service.getNetworkCustomizations() == null) { - msoLogger.debug("No networks were found on this service model"); + logger.debug("No networks were found on this service model"); } else { for (int i = 0; i < service.getNetworkCustomizations().size(); i++) { resourceCounter.add(new Resource(WorkflowType.NETWORK,service.getNetworkCustomizations().get(i).getModelCustomizationUUID(),false)); @@ -491,7 +507,7 @@ public class WorkflowAction { } } if (serviceInstanceMSO.getCollection() != null) { - msoLogger.debug("found networkcollection"); + logger.debug("found networkcollection"); aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.NETWORKCOLLECTION, serviceInstanceMSO.getCollection().getId())); resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,serviceInstanceMSO.getCollection().getId(),false)); } @@ -613,9 +629,10 @@ public class WorkflowAction { } } } - msoLogger.debug("found " + configurations.size() + " configurations"); + logger.debug("found {} configurations" , configurations.size() ); return configurations; } catch (Exception ex){ + logger.error("Error in finding configurations", ex); return configurations; } } @@ -649,7 +666,7 @@ public class WorkflowAction { Boolean generated = false; if (m.find()) { - msoLogger.debug("found match on " + uri + ": " + m); + logger.debug("found match on {} : {} " , uri , m); String type = m.group("type"); String id = m.group("id"); String action = m.group("action"); @@ -657,7 +674,7 @@ public class WorkflowAction { throw new IllegalArgumentException("Uri could not be parsed. No type found. " + uri); } if (action == null) { - if (type.equals("serviceInstances") && (id == null || id.equals("assign"))) { + if (type.equals(SERVICE_INSTANCES) && (id == null || id.equals("assign"))) { id = UUID.randomUUID().toString(); generated = true; } @@ -727,9 +744,9 @@ public class WorkflowAction { } return generatedResourceId; } catch (Exception ex) { - msoLogger.error(ex); + logger.error(WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI, ex); throw new IllegalStateException( - "WorkflowAction was unable to verify if the instance name already exist in AAI."); + WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI); } } @@ -737,7 +754,7 @@ public class WorkflowAction { if (!type.matches(supportedTypes)) { return type; } else { - if (type.equals("serviceInstances")) { + if (type.equals(SERVICE_INSTANCES)) { return SERVICE; } else { return type.substring(0, 1).toUpperCase() + type.substring(1, type.length() - 1); @@ -948,20 +965,19 @@ public class WorkflowAction { } protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg, ex); - execution.setVariable("WorkflowActionErrorMessage", msg); + logger.error(msg, ex); + execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); } protected void buildAndThrowException(DelegateExecution execution, String msg) { - msoLogger.error(msg); - execution.setVariable("WorkflowActionErrorMessage", msg); + logger.error(msg); + execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); } public void handleRuntimeException (DelegateExecution execution){ - StringBuffer wfeExpMsg = new StringBuffer("Runtime error "); + StringBuilder wfeExpMsg = new StringBuilder("Runtime error "); String runtimeErrorMessage = null; try{ String javaExpMsg = (String) execution.getVariable("BPMN_javaExpMsg"); @@ -969,10 +985,10 @@ public class WorkflowAction { wfeExpMsg = wfeExpMsg.append(": ").append(javaExpMsg); } runtimeErrorMessage = wfeExpMsg.toString(); - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, runtimeErrorMessage, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, runtimeErrorMessage); - execution.setVariable("WorkflowActionErrorMessage", runtimeErrorMessage); + logger.error(runtimeErrorMessage); + execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, runtimeErrorMessage); } catch (Exception e){ + logger.error("Runtime error", e); //if runtime message was mulformed runtimeErrorMessage = "Runtime error"; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java index a4b40393a3..67843a7ef9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java @@ -64,28 +64,10 @@ public class SDNCClient { STOClient.setTargetUrl(targetUrl); HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth()); STOClient.setHttpHeader(httpHeader); - msoLogger.info("Running SDNC CLIENT for TargetUrl: " + targetUrl); LinkedHashMap<?, ?> output = STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {}); - Optional<String> sdncResponse = logSDNCResponse(output); - if(sdncResponse.isPresent()){ - msoLogger.info(sdncResponse.get()); - } - msoLogger.info("Validating output..."); return sdnCommonTasks.validateSDNResponse(output); } - protected Optional<String> logSDNCResponse(LinkedHashMap<?, ?> output) { - ObjectMapper mapper = new ObjectMapper(); - String sdncOutput = ""; - try { - sdncOutput = mapper.writeValueAsString(output); - return Optional.of(sdncOutput); - } catch (JsonProcessingException e) { - msoLogger.debug("Failed to map response from sdnc to json string for logging purposes."); - } - return Optional.empty(); - } - /** * * @param queryLink @@ -102,12 +84,9 @@ public class SDNCClient { String jsonRequest = sdnCommonTasks.buildJsonRequest(request); String targetUrl = UriBuilder.fromUri(properties.getHost()).path(queryLink).build().toString(); STOClient.setTargetUrl(targetUrl); - msoLogger.info("TargetUrl: " + targetUrl); HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth()); STOClient.setHttpHeader(httpHeader); - msoLogger.info("Running SDNC CLIENT..."); LinkedHashMap<?, ?> output = STOClient.get(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {}); - msoLogger.info("Validating output..."); return sdnCommonTasks.validateSDNGetResponse(output); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java new file mode 100644 index 0000000000..d4956f9349 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.activity; + + +import static org.junit.Assert.assertEquals; + +import java.nio.file.Files; +import java.nio.file.Paths; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.junit.Before; + +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.springframework.beans.factory.annotation.Autowired; + +public class ExecuteActivityTest extends BaseTaskTest { + @Autowired + protected ExecuteActivity executeActivity; + + private DelegateExecution execution; + + @Before + public void before() throws Exception { + execution = new DelegateExecutionFake(); + execution.setVariable("vnfType", "testVnfType"); + execution.setVariable("requestAction", "testRequestAction"); + execution.setVariable("mso-request-id", "testMsoRequestId"); + execution.setVariable("vnfId", "testVnfId"); + execution.setVariable("serviceInstanceId", "testServiceInstanceId"); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + } + + @Test + public void buildBuildingBlock_Test(){ + BuildingBlock bb = executeActivity.buildBuildingBlock("testActivityName"); + assertEquals(bb.getBpmnFlowName(), "testActivityName"); + assertEquals(bb.getKey(), ""); + } + + @Test + public void executeBuildingBlock_Test() throws Exception { + BuildingBlock bb = executeActivity.buildBuildingBlock("testActivityName"); + ExecuteBuildingBlock ebb = executeActivity.buildExecuteBuildingBlock(execution, "testMsoRequestId", bb); + assertEquals(ebb.getVnfType(), "testVnfType"); + assertEquals(ebb.getRequestAction(), "testRequestAction"); + assertEquals(ebb.getRequestId(), "testMsoRequestId"); + assertEquals(ebb.getWorkflowResourceIds().getVnfId(), "testVnfId"); + assertEquals(ebb.getWorkflowResourceIds().getServiceInstanceId(), "testServiceInstanceId"); + assertEquals(ebb.getBuildingBlock(), bb); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksITTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksITTest.java new file mode 100644 index 0000000000..9e1dac69e0 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksITTest.java @@ -0,0 +1,103 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.appc.tasks; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.HashMap; +import java.util.Optional; +import java.util.UUID; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.onap.appc.client.lcm.model.Action; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; +import org.onap.so.db.catalog.beans.ControllerSelectionReference; +import org.springframework.beans.factory.annotation.Autowired; + +public class AppcRunTasksITTest extends BaseTaskTest { + + @Autowired + private AppcRunTasks appcRunTasks; + + private GenericVnf genericVnf; + private RequestContext requestContext; + private String msoRequestId; + + @Before + public void before() { + genericVnf = setGenericVnf(); + msoRequestId = UUID.randomUUID().toString(); + requestContext = setRequestContext(); + requestContext.setMsoRequestId(msoRequestId); + gBBInput.setRequestContext(requestContext); + } + + @Test + public void preProcessActivityTest() throws Exception { + appcRunTasks.preProcessActivity(execution); + assertEquals(execution.getVariable("actionQuiesceTraffic"), Action.QuiesceTraffic); + assertEquals(execution.getVariable("rollbackQuiesceTraffic"), false); + } + + @Test + public void runAppcCommandTest() throws Exception { + Action action = Action.QuiesceTraffic; + ControllerSelectionReference controllerSelectionReference = new ControllerSelectionReference(); + controllerSelectionReference.setControllerName("testName"); + controllerSelectionReference.setActionCategory(action.toString()); + controllerSelectionReference.setVnfType("testVnfType"); + + doReturn(controllerSelectionReference).when(catalogDbClient).getControllerSelectionReferenceByVnfTypeAndActionCategory(genericVnf.getVnfType(), Action.QuiesceTraffic.toString()); + + execution.setVariable("aicIdentity", "testAicIdentity"); + + String vnfId = genericVnf.getVnfId(); + genericVnf.setIpv4OamAddress("testOamIpAddress"); + String payload = "{\"testName\":\"testValue\",}"; + RequestParameters requestParameters = new RequestParameters(); + requestParameters.setPayload(payload); + gBBInput.getRequestContext().setRequestParameters(requestParameters); + + String controllerType = "testName"; + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + payloadInfo.put("vnfName", "testVnfName1"); + payloadInfo.put("aicIdentity", "testAicIdentity"); + payloadInfo.put("vnfHostIpAddress", "testOamIpAddress"); + payloadInfo.put("vserverIdList", null); + payloadInfo.put("vfModuleId", null); + payloadInfo.put("identityUrl", null); + payloadInfo.put("vmIdList", null); + + doNothing().when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType); + + appcRunTasks.runAppcCommand(execution, action); + verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java new file mode 100644 index 0000000000..7cade7703a --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java @@ -0,0 +1,36 @@ +package org.onap.so.bpmn.infrastructure.appc.tasks; + +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; + +import org.junit.Test; +import org.onap.appc.client.lcm.model.Action; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class AppcRunTasksTest { + + + private AppcRunTasks appcRunTasks = new AppcRunTasks(); + @Test + public void mapRollbackVariablesTest() { + + BuildingBlockExecution mock = mock(BuildingBlockExecution.class); + + appcRunTasks.mapRollbackVariables(mock, Action.Lock, "1"); + verify(mock, times(0)).setVariable(any(String.class), any()); + appcRunTasks.mapRollbackVariables(mock, Action.Lock, "0"); + verify(mock, times(1)).setVariable("rollbackVnfLock", true); + appcRunTasks.mapRollbackVariables(mock, Action.Unlock, "0"); + verify(mock, times(1)).setVariable("rollbackVnfLock", false); + appcRunTasks.mapRollbackVariables(mock, Action.Start, "0"); + verify(mock, times(1)).setVariable("rollbackVnfStop", false); + appcRunTasks.mapRollbackVariables(mock, Action.Stop, "0"); + verify(mock, times(1)).setVariable("rollbackVnfStop", true); + appcRunTasks.mapRollbackVariables(mock, Action.QuiesceTraffic, "0"); + verify(mock, times(1)).setVariable("rollbackQuiesceTraffic", true); + appcRunTasks.mapRollbackVariables(mock, Action.ResumeTraffic, "0"); + verify(mock, times(1)).setVariable("rollbackQuiesceTraffic", false); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasksTest.java new file mode 100644 index 0000000000..03ed2cb4d4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasksTest.java @@ -0,0 +1,68 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.tasks; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.springframework.beans.factory.annotation.Autowired; + +public class FlowCompletionTasksTest extends BaseTaskTest { + + @Autowired + protected FlowCompletionTasks flowCompletionTasks; + + @Before + public void before() { + setRequestContext(); + } + + @Test + public void updateRequestDbStatusComplete_Test() throws Exception{ + InfraActiveRequests mockedRequest = new InfraActiveRequests(); + when(requestsDbClient.getInfraActiveRequestbyRequestId(any(String.class))).thenReturn(mockedRequest); + doNothing().when(requestsDbClient).updateInfraActiveRequests(any(InfraActiveRequests.class)); + flowCompletionTasks.updateRequestDbStatus(execution); + verify(requestsDbClient, times(1)).updateInfraActiveRequests(any(InfraActiveRequests.class)); + assertEquals(mockedRequest.getRequestStatus(), "COMPLETE"); + } + + @Test + public void updateRequestDbStatusFailed_Test() throws Exception{ + WorkflowException workflowException = new WorkflowException("testProcessKey", 7000, "Error"); + execution.setVariable("WorkflowException", workflowException); + InfraActiveRequests mockedRequest = new InfraActiveRequests(); + when(requestsDbClient.getInfraActiveRequestbyRequestId(any(String.class))).thenReturn(mockedRequest); + doNothing().when(requestsDbClient).updateInfraActiveRequests(any(InfraActiveRequests.class)); + flowCompletionTasks.updateRequestDbStatus(execution); + verify(requestsDbClient, times(1)).updateInfraActiveRequests(any(InfraActiveRequests.class)); + assertEquals(mockedRequest.getRequestStatus(), "FAILED"); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientLogResponseTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientLogResponseTest.java deleted file mode 100644 index e28c465437..0000000000 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientLogResponseTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.sdnc; - -import static org.junit.Assert.*; - -import java.util.LinkedHashMap; -import java.util.Optional; - -import org.junit.Test; - -public class SDNCClientLogResponseTest { - - private SDNCClient sdncClient = new SDNCClient(); - - @Test - public void logSDNCResponseTest() { - LinkedHashMap<String, String> output = new LinkedHashMap<>(); - output.put("response-code", "404"); - output.put("response-message", "not found"); - Optional<String> response = sdncClient.logSDNCResponse(output); - assertEquals(true, response.isPresent()); - assertEquals("{\"response-code\":\"404\",\"response-message\":\"not found\"}",response.get()); - } -} |