diff options
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src')
79 files changed, 1431 insertions, 1408 deletions
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 f640aa74f7..64de29eaa9 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 @@ -29,8 +29,10 @@ 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.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.core.UrnPropertiesReader import org.onap.so.logger.MsoLogger /** @@ -47,6 +49,8 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { JsonUtils jsonUtil = new JsonUtils() SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + MsoUtils msoUtils = new MsoUtils() public void preProcessRequest(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") @@ -147,13 +151,13 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <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> + <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> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; @@ -162,7 +166,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { } private void setProgressUpdateVariables(DelegateExecution execution, String body) { - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) execution.setVariable("CVFMI_updateResOperStatusRequest", body) } @@ -227,44 +231,44 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { 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.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(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.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <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> + <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> </onap-model-information> - <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-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> </service-information> <vnf-information> - <vnf-id>${msoUtils.xmlEncode(networkInstanceId)}</vnf-id> + <vnf-id>${msoUtils.xmlEscape(networkInstanceId)}</vnf-id> <vnf-type></vnf-type> <onap-model-information> - <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> + <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> </onap-model-information> </vnf-information> <vnf-request-input> @@ -287,45 +291,45 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { 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.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(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.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <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> + <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> </onap-model-information> - <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> </service-information> <allotted-resource-information> <!-- TODO: to be filled as per the request input --> - <allotted-resource-id>${msoUtils.xmlEncode(networkInstanceId)}</allotted-resource-id> + <allotted-resource-id>${msoUtils.xmlEscape(networkInstanceId)}</allotted-resource-id> <allotted-resource-type></allotted-resource-type> <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id> <onap-model-information> - <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> + <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> </onap-model-information> </allotted-resource-information> <connection-attachment-request-input> @@ -342,43 +346,43 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { 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.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <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:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <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> + <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> </onap-model-information> - <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> </service-information> <network-information> <!-- TODO: to be filled by response from create --> - <network-id>${msoUtils.xmlEncode(networkInstanceId)}</network-id> + <network-id>${msoUtils.xmlEscape(networkInstanceId)}</network-id> <onap-model-information> - <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> + <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> </onap-model-information> </network-information> <network-request-input> 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 cd583f77ef..afd67c37f5 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 @@ -7,9 +7,9 @@ * 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. @@ -29,18 +29,23 @@ import groovy.xml.XmlUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.ExternalAPIUtil -import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.aai.domain.yang.SpPartner 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.core.UrnPropertiesReader import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder -import org.onap.so.rest.APIResponse +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory import java.util.Map import java.util.UUID +import javax.ws.rs.core.Response import org.onap.so.logger.MsoLogger import org.camunda.bpm.engine.runtime.Execution @@ -48,13 +53,11 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64 -import org.springframework.web.util.UriUtils -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig + /** * This groovy class supports the <class>Create3rdONAPE2EServiceInstance.bpmn</class> process. - * flow for Create E2EServiceInstance in 3rdONAP + * flow for Create E2EServiceInstance in 3rdONAP */ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcessor { @@ -82,10 +85,10 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String resourceInputPrameters = resourceInputObj.getResourceParameters() 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("sppartner_url")) @@ -123,7 +126,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String msg = "sppartner providingServiceInvarianteUuid is blank." msoLogger.debug(msg) } - + if(inputParameters.has("sppartner_handoverMode")) { String handoverMode = inputParameters.get("sppartner_handoverMode") @@ -141,21 +144,19 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable("mso-request-id", requestId) execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) - } catch (BpmnError e) { - throw e } catch (Exception ex){ String msg = "Exception in checkSPPartnerInfo " + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void checkLocallCall (DelegateExecution execution) { msoLogger.info(" ***** Started checkLocallCall *****") try { - + //Get ResourceInput Object - ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") + ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") //uuiRequest String incomingRequest = resourceInputObj.getRequestsInputs() @@ -163,7 +164,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String requestInputs = JsonUtils.getJsonValue(serviceParameters, "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) boolean isLocalCall = true String callSource = "UUI" @@ -174,17 +175,17 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String sppartnerId = inputParameters.get("SppartnerServiceId") execution.setVariable(Prefix + "SppartnerServiceId", sppartnerId) isLocalCall = false - } + } } execution.setVariable(Prefix + "CallSource", callSource) msoLogger.debug("callSource is: " + callSource ) - + execution.setVariable("IsLocalCall", isLocalCall) } catch (Exception ex){ String msg = "Exception in checkLocallCall " + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -211,7 +212,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } execution.setVariable("serviceType", serviceType) msoLogger.info("serviceType:" + serviceType) - + String resourceName = resourceInputObj.getResourceInstanceName() if (isBlank(resourceName)) { msg = "Input resourceName is null" @@ -219,11 +220,11 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } execution.setVariable("resourceName", resourceName) msoLogger.info("resourceName:" + resourceName) - + int beginIndex = resourceName.indexOf("_") + 1 String serviceInstanceName = resourceName.substring(beginIndex) execution.setVariable("serviceInstanceName", serviceInstanceName) - + String serviceInstanceId = resourceInputObj.getServiceInstanceId() if (isBlank(serviceInstanceId)) { msg = "Input serviceInstanceId is null" @@ -239,7 +240,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } execution.setVariable(Prefix + "ResourceModelInvariantUuid", resourceModelInvariantUuid) msoLogger.info("resourceModelInvariantUuid:" + resourceModelInvariantUuid) - + String resourceModelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() if (isBlank(resourceModelUuid)) { msg = "Input resourceModelUuid is null" @@ -247,7 +248,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } execution.setVariable(Prefix + "ResourceModelUuid", resourceModelUuid) msoLogger.info("resourceModelUuid:" + resourceModelUuid) - + String resourceModelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() if (isBlank(resourceModelCustomizationUuid)) { msg = "Input resourceModelCustomizationUuid is null" @@ -256,12 +257,10 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable(Prefix + "ResourceModelCustomizationUuid", resourceModelCustomizationUuid) msoLogger.info("resourceModelCustomizationUuid:" + resourceModelCustomizationUuid) - } catch (BpmnError e) { - throw e } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -300,7 +299,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso public void allocateCrossONAPResource(DelegateExecution execution) { msoLogger.info(" ***** Started allocateCrossONAPResource *****") - + //get TP links from AAI for SOTN handoverMode only String handoverMode = execution.getVariable(Prefix + "HandoverMode") if("SOTN".equalsIgnoreCase(handoverMode)) { @@ -318,7 +317,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso 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")); @@ -336,17 +335,17 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso msoLogger.error("No allocated CrossONAPResource found in ServiceParameters") } } - + msoLogger.info("Exit " + allocateCrossONAPResource) } public void prepare3rdONAPRequest(DelegateExecution execution) { msoLogger.info(" ***** Started prepare3rdONAPRequest *****") - + String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") String extAPIPath = sppartnerUrl + '/serviceOrder' execution.setVariable("ExternalAPIURL", extAPIPath) - + // ExternalAPI message format String externalId = execution.getVariable("resourceName") String category = "E2E Service" @@ -363,7 +362,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String serviceState = "active" String serviceName = execution.getVariable("serviceInstanceName") String serviceUuId = execution.getVariable(Prefix + "SppartnerUUID") - + Map<String, String> valueMap = new HashMap<>() valueMap.put("externalId", '"' + externalId + '"') valueMap.put("category", '"' + category + '"') @@ -381,30 +380,30 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso valueMap.put("serviceId", "null") //null for add valueMap.put("serviceName", '"' + serviceName + '"') valueMap.put("serviceUuId", '"' + serviceUuId + '"') - + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() - - // insert CallSource='ExternalAPI' to uuiRequest + + // insert CallSource='ExternalAPI' to uuiRequest Map<String, String> requestInputsMap = new HashMap<>() requestInputsMap.put("inputName", '"CallSource"') requestInputsMap.put("inputValue", '"ExternalAPI"') String _requestInputs_ = externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) - + requestInputsMap.clear() String serviceInstanceId = execution.getVariable(Prefix + "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) - + // Transfer all uuiRequest incomeParameters to ExternalAPI format JSONObject inputParameters = execution.getVariable(Prefix + "ServiceParameters") - for(String key : inputParameters.keySet()) { + for(String key : inputParameters.keySet()) { String inputName = key String inputValue = inputParameters.opt(key) requestInputsMap.clear() @@ -413,7 +412,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso _requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) } valueMap.put("_requestInputs_", _requestInputs_) - + String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap) execution.setVariable(Prefix + "Payload", payload) msoLogger.info("Exit " + prepare3rdONAPRequest) @@ -421,29 +420,30 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso public void doCreateE2ESIin3rdONAP(DelegateExecution execution) { msoLogger.info(" ***** Started doCreateE2ESIin3rdONAP *****") - + try { 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() + execution.setVariable("ServiceOrderId", "") - APIResponse response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload) + Response response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload) - int responseCode = response.getStatusCode() + int responseCode = response.getStatus() execution.setVariable(Prefix + "PostServiceOrderResponseCode", responseCode) msoLogger.debug("Post ServiceOrder response code is: " + responseCode) - String extApiResponse = response.getResponseBodyAsString() + String extApiResponse = response.readEntity(String.class) 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 + //200 OK 201 CREATED 202 ACCEPTED { msoLogger.debug("Post ServiceOrder Received a Good Response") String serviceOrderId = responseObj.get("id") @@ -455,32 +455,36 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso 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") } - + }catch(Exception e){ + msoLogger.error("doCreateE2ESIin3rdONAP exception:" + e.getMessage()) + } + msoLogger.info("Exit " + doCreateE2ESIin3rdONAP) } - + public void getE2ESIProgressin3rdONAP(DelegateExecution execution) { msoLogger.info(" ***** Started getE2ESIProgressin3rdONAP *****") - + try { + String extAPIPath = execution.getVariable("ExternalAPIURL") extAPIPath += "/" + execution.getVariable("ServiceOrderId") - utils.log("DEBUG", "getE2ESIProgressin3rdONAP create externalAPIURL is: " + extAPIPath, isDebugEnabled) - + msoLogger.debug("getE2ESIProgressin3rdONAP create externalAPIURL is: " + extAPIPath) + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() - APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) + Response response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) - int responseCode = response.getStatusCode() + int responseCode = response.getStatus() execution.setVariable(Prefix + "GetServiceOrderResponseCode", responseCode) msoLogger.debug("Get ServiceOrder response code is: " + responseCode) - String extApiResponse = response.getResponseBodyAsString() + String extApiResponse = response.readEntity(String.class) 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 ) { @@ -511,7 +515,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String serviceOrderState = item.get("state") execution.setVariable(Prefix + "SuccessIndicator", true) execution.setVariable("ServiceOrderState", serviceOrderState) - + // Get serviceOrder State and process progress if("ACKNOWLEDGED".equalsIgnoreCase(serviceOrderState)) { execution.setVariable("progress", 15) @@ -539,17 +543,23 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable("statusDescription", "Create Service Order Status is unknown") } } - else{ + 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 Create ServiceOrder Received a bad response") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Create ServiceOrder Received a bad response from 3rdONAP External API") - } - +// exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Create ServiceOrder Received a bad response from 3rdONAP External API") + } + + }catch(Exception e){ + execution.setVariable("progress", 100) + execution.setVariable("status", "error") + execution.setVariable("statusDescription", "Get Create ServiceOrder Exception") + msoLogger.error("getE2ESIProgressin3rdONAP exception:" + e.getMessage()) + } msoLogger.info("Exit " + getE2ESIProgressin3rdONAP) } - + /** * delay 5 sec */ @@ -562,8 +572,8 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } public void saveSPPartnerInAAI(DelegateExecution execution) { - msoLogger.info(" ***** Started saveSPPartnerInAAI *****") - + msoLogger.info(" ***** Started saveSPPartnerInAAI *****") + try { String sppartnerId = execution.getVariable(Prefix + "SppartnerServiceId") String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") String callSource = execution.getVariable(Prefix + "CallSource") @@ -574,65 +584,33 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String resourceModelUuid = execution.getVariable(Prefix + "ResourceModelUuid") String resourceModelCustomizationUuid = execution.getVariable(Prefix + "ResourceModelCustomizationUuid") - AaiUtil aaiUriUtil = new AaiUtil() - String aai_uri = aaiUriUtil.getBusinessSPPartnerUri(execution) - String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) - - String payload = - """<sp-partner xmlns=\"${namespace}\"> - <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> - <related-link>/aai/v14/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${serviceInstanceId}</related-link> - <relationship-data> - <relationship-key>service-instance.service-instance-id</relationship-key> - <relationship-value>${serviceInstanceId}</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </sp-partner>""".trim() - utils.logAudit(payload) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(sppartnerId,"UTF-8") - - APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload) - int responseCode = response.getStatusCode() - execution.setVariable(Prefix + "PutSppartnerResponseCode", responseCode) - msoLogger.debug("Put sppartner response code is: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - execution.setVariable(Prefix + "PutSppartnerResponse", aaiResponse) - - //Process Response - if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) - //200 OK 201 CREATED 202 ACCEPTED - { - msoLogger.debug("PUT sppartner Received a Good Response") - execution.setVariable(Prefix + "SuccessIndicator", true) - } - else - { - msoLogger.debug("Put sppartner Received a Bad Response Code. Response Code is: " + responseCode) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - + SpPartner partner = new SpPartner() + partner.setSpPartnerId(sppartnerId) + partner.setUrl(sppartnerUrl) + partner.setCallsource(callSource) + partner.setModelInvariantId(resourceModelInvariantUuid) + partner.setModelVersionId(resourceModelUuid) + partner.setModelCustomizationId(resourceModelCustomizationUuid) + + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SP_PARTNER, sppartnerId) + client.create(uri, partner) + + AAIResourceUri siUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) + client.connect(uri, siUri) + } catch (Exception ex) { + String msg = "Exception in Create3rdONAPE2EServiceInstance.saveSPPartnerInAAI. " + ex.getMessage() + msoLogger.info(msg) +// throw new BpmnError("MSOWorkflowException") + } msoLogger.info("Exit " + saveSPPartnerInAAI) } private void setProgressUpdateVariables(DelegateExecution execution, String body) { - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) execution.setVariable("CVFMI_updateResOperStatusRequest", body) - } + } public void postProcess(DelegateExecution execution){ msoLogger.info(" ***** Started postProcess *****") @@ -657,7 +635,7 @@ public class Create3rdONAPE2EServiceInstance 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/CreateDeviceResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy index 89a6239be7..ff9a119d6d 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 @@ -7,9 +7,9 @@ * 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. @@ -26,28 +26,26 @@ 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.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.common.resource.ResourceRequestBuilder +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder import org.onap.so.logger.MsoLogger -import org.onap.so.rest.APIResponse import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import java.util.UUID; -import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig -import org.onap.so.rest.APIResponse; -import org.onap.so.bpmn.common.scripts.AaiUtil +import org.apache.commons.codec.binary.Base64 + /** * This groovy class supports the <class>CreateDeviceResource.bpmn</class> process. @@ -56,18 +54,18 @@ import org.onap.so.bpmn.common.scripts.AaiUtil public class CreateDeviceResource extends AbstractServiceTaskProcessor { String Prefix="CREDEVRES_" - + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateDeviceResource.class) public void preProcessRequest(DelegateExecution execution){ msoLogger.info(" ***** Started preProcessRequest *****") String msg = "" - try { - + try { + //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") @@ -90,10 +88,10 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { // 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() + String resourceName = resourceInputObj.getResourceInstanceName() if (isBlank(resourceName)) { msg = "Input resourceName is null" msoLogger.error(msg) @@ -108,7 +106,7 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { } execution.setVariable(Prefix + "ResourceModelInvariantUuid", resourceModelInvariantUuid) msoLogger.info("resourceModelInvariantUuid:" + resourceModelInvariantUuid) - + String resourceModelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() if (isBlank(resourceModelUuid)) { msg = "Input resourceModelUuid is null" @@ -116,7 +114,7 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { } execution.setVariable(Prefix + "ResourceModelUuid", resourceModelUuid) msoLogger.info("resourceModelUuid:" + resourceModelUuid) - + String resourceModelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() if (isBlank(resourceModelCustomizationUuid)) { msg = "Input resourceModelCustomizationUuid is null" @@ -127,46 +125,40 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) - - } catch (BpmnError e) { - throw e; + } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } - + public void checkDevType(DelegateExecution execution){ msoLogger.info(" ***** Started checkDevType *****") try { 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) } catch (Exception ex){ String msg = "Exception in checkDevType " + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } - + private void setProgressUpdateVariables(DelegateExecution execution, String body) { - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) 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") @@ -199,8 +191,8 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { setProgressUpdateVariables(execution, body) msoLogger.info(" ***** Exit prepareUpdateProgress *****") } - - public void getVNFTemplatefromSDC(DelegateExecution execution){ + + private void getVNFTemplatefromSDC(DelegateExecution execution){ msoLogger.info(" ***** Started getVNFTemplatefromSDC *****") try { // To do @@ -209,23 +201,110 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { } catch (Exception ex){ String msg = "Exception in getVNFTemplatefromSDC " + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } - - public void postVNFInfoProcess(DelegateExecution execution){ - msoLogger.info(" ***** Started postVNFInfoProcess *****") - try { - // To do + public void prepareVnfAndModulesCreate(DelegateExecution execution) { + try { + msoLogger.trace("Inside prepareVnfAndModulesCreate of CreateDeviceResource ") + + JSONObject resourceInputParameters = execution.getVariable(Prefix + "ResourceRequestInputs") + String devType = resourceInputParameters.get("device_type") + String devVersion = resourceInputParameters.get("device_version") + + //get vnf model from SDC + getVNFTemplatefromSDC(execution) + + VnfResource vnf = execution.getVariable("vnfResource") + Integer vnfsCreatedCount = execution.getVariable(Prefix + "VnfsCreatedCount") + String vnfModelInfoString = null; + + if (vnf != null) { + msoLogger.debug("getting model info for vnf # " + vnfsCreatedCount) + ModelInfo vnfModelInfo = vnf.getModelInfo() + vnfModelInfoString = vnfModelInfo.toString() + } else { + msoLogger.debug("vnf is null") + vnfModelInfoString = execution.getVariable("vnfModelInfo") + } + + msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString) + + // extract cloud configuration +// String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest, +// "requestDetails.cloudConfiguration.lcpCloudRegionId") +// def cloudRegion = vimId.split("_") +// execution.setVariable("cloudOwner", cloudRegion[0]) +// msoLogger.debug("cloudOwner: "+ cloudRegion[0]) +// execution.setVariable("cloudRegionId", cloudRegion[1]) +// msoLogger.debug("cloudRegionId: "+ cloudRegion[1]) +// execution.setVariable("lcpCloudRegionId", cloudRegion[1]) +// msoLogger.debug("lcpCloudRegionId: "+ cloudRegion[1]) +// String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, +// "requestDetails.cloudConfiguration.tenantId") +// execution.setVariable("tenantId", tenantId) +// msoLogger.debug("tenantId: " + tenantId) + + + execution.setVariable("cloudOwner", "") + + execution.setVariable("cloudRegionId", "") + + execution.setVariable("lcpCloudRegionId", "") + + execution.setVariable("tenantId", "") + + String sdncVersion = execution.getVariable("sdncVersion") + msoLogger.debug("sdncVersion: " + sdncVersion) + + msoLogger.trace("Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ") + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateDeviceResource flow. Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + } + } + + // ******************************* + // Validate Vnf request Section -> increment count + // ******************************* + public void validateVnfCreate(DelegateExecution execution) { + + try { + msoLogger.trace("Inside validateVnfCreate of CreateDeviceResource ") + + //Update Relationship between VNF to Device + addVNFAAIRelationShip(execution) + + Integer vnfsCreatedCount = execution.getVariable(Prefix + "VnfsCreatedCount") + vnfsCreatedCount++ + + execution.setVariable(Prefix + "VnfsCreatedCount", vnfsCreatedCount) + + msoLogger.debug(" ***** Completed validateVnfCreate of CreateDeviceResource ***** " + " vnf # " + vnfsCreatedCount) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateDeviceResource flow. Unexpected Error from method validateVnfCreate() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + } + } + + public void addVNFAAIRelationShip(DelegateExecution execution) { + + try { + msoLogger.trace("Inside addVNFAAIRelationShip of CreateDeviceResource ") + + + + msoLogger.debug(" ***** Completed addVNFAAIRelationShip of CreateDeviceResource ***** ") + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateDeviceResource flow. Unexpected Error from method addVNFAAIRelationShip() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + } + } - } catch (Exception ex){ - String msg = "Exception in postVNFInfoProcess " + ex.getMessage() - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - } - public void sendSyncResponse (DelegateExecution execution) { msoLogger.debug(" *** sendSyncResponse *** ") @@ -240,7 +319,7 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { } catch (Exception ex) { String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } utils.log("DEBUG"," ***** Exit sendSyncResopnse *****") } 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 9763960bfd..848785e5f3 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 @@ -165,6 +165,10 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro msoLogger.debug("User Input Parameter " + userParam.name + ": " + userParam.value.toString()) inputMap.put(userParam.name, userParam.value) } + if ("Orchestrator".equalsIgnoreCase(userParam?.name)) { + execution.setVariable("orchestrator", userParam.value) + inputMap.put("orchestrator", userParam.value) + } } } @@ -344,6 +348,10 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro msoLogger.debug("User Input Parameter " + userParam.name + ": " + userParam.value.toString()) inputMap.put(userParam.name, userParam.value) } + if ("Orchestrator".equalsIgnoreCase(userParam?.name)) { + execution.setVariable("orchestrator", userParam.value) + inputMap.put("orchestrator", userParam.value) + } } } 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 47b3cc351f..d0a3dddba9 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 @@ -7,9 +7,9 @@ * 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. @@ -25,14 +25,21 @@ 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.aai.domain.yang.ServiceInstance +import org.onap.aai.domain.yang.ServiceInstances import org.onap.so.bpmn.common.recipe.ResourceInput import org.onap.so.bpmn.common.resource.ResourceRequestBuilder 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.json.JsonUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.client.aai.AAIObjectPlurals +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MsoLogger -import org.onap.so.rest.APIResponse import static org.apache.commons.lang3.StringUtils.* @@ -49,8 +56,10 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { JsonUtils jsonUtil = new JsonUtils() + MsoUtils msoUtils = new MsoUtils() + public void preProcessRequest(DelegateExecution execution){ - + msoLogger.info(" ***** Started preProcessRequest *****") try { @@ -208,27 +217,20 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { 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 + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer, serviceType).queryParam("service-instance-name", parentServiceName) + ServiceInstances sis = client.get(uri).asBean(ServiceInstances.class).get() + ServiceInstance si = sis.getServiceInstance().get(0) - APIResponse aaiResponse = aaiUtil.executeAAIGetCall(execution, aai_service_query_url) - def parentServiceInstanceId = getParentServiceInstnaceId(aaiResponse) - execution.setVariable("parentServiceInstanceId", parentServiceInstanceId) - break + def parentServiceInstanceId = si.getServiceInstanceId() + 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 * Includes: @@ -277,44 +279,44 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { 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.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(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.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <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> + <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> </onap-model-information> - <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-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> </service-information> <vnf-information> <vnf-id></vnf-id> <vnf-type></vnf-type> <onap-model-information> - <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> + <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> </onap-model-information> </vnf-information> <vnf-request-input> @@ -336,34 +338,34 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { 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.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(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.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <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> + <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> </onap-model-information> - <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-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> </service-information> <allotted-resource-information> <!-- TODO: to be filled as per the request input --> @@ -371,11 +373,11 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { <allotted-resource-type></allotted-resource-type> <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id> <onap-model-information> - <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> + <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> </onap-model-information> </allotted-resource-information> <connection-attachment-request-input> @@ -388,44 +390,44 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { // 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:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> <sdncadapter:RequestId>${hdrRequestId}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(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.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <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> + <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> </onap-model-information> - <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> </service-information> <network-information> <onap-model-information> - <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> + <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> </onap-model-information> </network-information> <network-request-input> @@ -450,7 +452,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { } private void setProgressUpdateVariables(DelegateExecution execution, String body) { - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) execution.setVariable("CVFMI_updateResOperStatusRequest", body) } @@ -473,13 +475,13 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <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> + <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> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; @@ -506,13 +508,13 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <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> + <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> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy index 26f12831bd..e3702f1014 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,23 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.infrastructure.scripts; +package org.onap.so.bpmn.infrastructure.scripts -import static org.apache.commons.lang3.StringUtils.*; - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -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.json.JsonUtils +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.HttpClient import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger -import org.onap.so.rest.APIResponse -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig import groovy.json.* +import javax.ws.rs.core.Response +import org.onap.so.utils.TargetEntity /** * This groovy class supports the <class>DoCreateVFCNetworkServiceInstance.bpmn</class> process. @@ -46,9 +45,9 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { String vfcUrl = "/vfc/rest/v1/vfcadapter" - + String host = "http://mso.mso.testlab.openecomp.org:8080" - + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -116,7 +115,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { execution.setVariable("nsOperationKey", nsOperationKey); execution.setVariable("nsParameters", nsParameters) execution.setVariable("nsServiceModelUUID", nsServiceModelUUID); - + } catch (BpmnError e) { throw e; @@ -150,9 +149,9 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { "additionalParamForNs":${requestInputs} } }""" - APIResponse apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() + Response apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody) + String returnCode = apiResponse.getStatus() + String aaiResponseAsString = apiResponse.readEntity(String.class) String nsInstanceId = ""; if(returnCode== "200" || returnCode == "201"){ nsInstanceId = jsonUtil.getJsonValue(aaiResponseAsString, "nsInstanceId") @@ -178,9 +177,9 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { }""" String nsInstanceId = execution.getVariable("nsInstanceId") String url = host + vfcUrl + "/ns/" +nsInstanceId + "/instantiate" - APIResponse apiResponse = postRequest(execution, url, reqBody) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() + Response apiResponse = postRequest(execution, url, reqBody) + String returnCode = apiResponse.getStatus() + String aaiResponseAsString = apiResponse.readEntity(String.class) String jobId = ""; if(returnCode== "200"|| returnCode == "201"){ jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") @@ -197,9 +196,9 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { String jobId = execution.getVariable("jobId") String nsOperationKey = execution.getVariable("nsOperationKey"); String url = host + vfcUrl + "/jobs/" + jobId - APIResponse apiResponse = postRequest(execution, url, nsOperationKey) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() + Response apiResponse = postRequest(execution, url, nsOperationKey) + String returnCode = apiResponse.getStatus() + String aaiResponseAsString = apiResponse.readEntity(String.class) String operationStatus = "error" if(returnCode== "200"|| returnCode == "201"){ operationStatus = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.status") @@ -209,12 +208,12 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { } /** - * delay 5 sec + * delay 5 sec */ public void timeDelay(DelegateExecution execution) { try { Thread.sleep(5000); - } catch(InterruptedException e) { + } catch(InterruptedException e) { msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Time Delay exception" + e , "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); } } @@ -232,53 +231,17 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { String globalSubscriberId = execution.getVariable("globalSubscriberId") String serviceType = execution.getVariable("serviceType") String serviceId = execution.getVariable("serviceInstanceId") - String addRelationPayload = """<relationship xmlns="http://org.openecomp.aai.inventory/v11"> - <related-to>service-instance</related-to> - <related-link>/aai/v11/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${nsInstanceId}</related-link> - <relationship-data> - <relationship-key>customer.global-customer-id</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(globalSubscriberId)}</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>service-subscription.service-type</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(serviceType)}</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>service-instance.service-instance-id</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(nsInstanceId)}</relationship-value> - </relationship-data> - </relationship>""" - String endpoint = execution.getVariable("URN_aai_endpoint") - msoLogger.info("Add Relationship req:\n" + addRelationPayload) - String url = endpoint + "/aai/v11/business/customers/customer/" + globalSubscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances/service-instance/" + serviceId + "/relationship-list/relationship" - APIResponse aaiRsp = executeAAIPutCall(execution, url, addRelationPayload) - msoLogger.info("aai response status code:" + aaiRsp.getStatusCode()) - msoLogger.info("aai response content:" + aaiRsp.getResponseBodyAsString()) - msoLogger.info(" *****Exit addNSRelationship *****") - } - - public APIResponse executeAAIPutCall(DelegateExecution execution, String url, String payload){ - msoLogger.trace("Started Execute AAI Put Process ") - APIResponse apiResponse = null + + AAIResourceUri nsUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,globalSubscriberId,serviceType,nsInstanceId) + AAIResourceUri relatedServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,globalSubscriberId,serviceType,serviceId) + try{ - String uuid = utils.getRequestID() - msoLogger.info("Generated uuid is: " + uuid) - msoLogger.info("URL to be used is: " + url) - String userName = execution.getVariable("URN_aai_auth") - String password = execution.getVariable("URN_mso_msoKey") - String basicAuthCred = utils.getBasicAuth(userName,password) - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - apiResponse = client.httpPut(payload) - msoLogger.trace("Completed Execute AAI Put Process ") + getAAIClient().connect(nsUri,relatedServiceUri) + msoLogger.info("NS relationship to Service added successfully") }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Put Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while Creating NS relationship.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getMessage(),e); throw new BpmnError("MSOWorkflowException") } - return apiResponse } /** @@ -286,23 +249,29 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { * url: the url of the request * requestBody: the body of the request */ - private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){ + private Response postRequest(DelegateExecution execution, String urlString, String requestBody){ msoLogger.trace("Started Execute VFC adapter Post Process ") msoLogger.info("url:"+url +"\nrequestBody:"+ requestBody) - APIResponse apiResponse = null + Response apiResponse = null try{ - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); - apiResponse = client.httpPost(requestBody) - msoLogger.info("response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString()) + + URL url = new URL(urlString); + + HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER) + httpClient.addAdditionalHeader("Accept", "application/json") + httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk") + + apiResponse = httpClient.post(requestBody) + + msoLogger.info("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) msoLogger.trace("Completed Execute VF-C adapter Post Process ") }catch(Exception e){ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Post Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); throw new BpmnError("MSOWorkflowException") - } + } return apiResponse } - + public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG", " *** sendSyncResponse *** ", 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 f13141751b..6ab03b9769 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 @@ -27,8 +27,10 @@ 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.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.core.UrnPropertiesReader import org.onap.so.logger.MsoLogger /** @@ -44,6 +46,8 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor JsonUtils jsonUtil = new JsonUtils() SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + MsoUtils msoUtils = new MsoUtils() public void preProcessRequest(DelegateExecution execution) { @@ -165,44 +169,44 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor 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.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(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.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <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> + <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> </onap-model-information> - <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-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> </service-information> <vnf-information> <vnf-id>$resourceInstnaceId</vnf-id> <vnf-type></vnf-type> <onap-model-information> - <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> + <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> </onap-model-information> </vnf-information> <vnf-request-input> @@ -223,33 +227,33 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor 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.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(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.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <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> + <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> </onap-model-information> - <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> <subscriber-name></subscriber-name> </service-information> <allotted-resource-information> @@ -257,11 +261,11 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor <allotted-resource-type></allotted-resource-type> <parent-service-instance-id></parent-service-instance-id> <onap-model-information> - <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> + <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> </onap-model-information> </allotted-resource-information> <connection-attachment-request-input> @@ -275,42 +279,42 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor 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.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <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:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <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> + <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> </onap-model-information> - <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> </service-information> <network-information> <network-id>$resourceInstnaceId</network-id> <onap-model-information> - <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> + <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> </onap-model-information> </network-information> <network-request-input> @@ -352,13 +356,13 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <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> + <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> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; @@ -367,13 +371,14 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor } private void setProgressUpdateVariables(DelegateExecution execution, String body) { - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) execution.setVariable("CVFMI_updateResOperStatusRequest", body) } public void postDeactivateSDNCCall(DelegateExecution execution) { - msoLogger.info(" ***** Started prepareSDNCRequest *****") String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode") + 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) 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 56e5be04a5..052b28dd04 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 @@ -7,9 +7,9 @@ * 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. @@ -20,39 +20,32 @@ package org.onap.so.bpmn.infrastructure.scripts -import org.json.JSONArray -import org.json.JSONObject -import org.json.XML +import javax.ws.rs.NotFoundException +import javax.ws.rs.core.Response +import org.apache.commons.lang3.StringUtils import static org.apache.commons.lang3.StringUtils.* -import groovy.xml.XmlUtil +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONArray +import org.json.JSONObject +import org.onap.aai.domain.yang.SpPartner +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.onap.so.bpmn.common.scripts.ExternalAPIUtil -import org.onap.so.bpmn.common.scripts.AaiUtil -import org.onap.so.bpmn.common.scripts.MsoUtils -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.infrastructure.workflow.service.ServicePluginFactory -import java.util.UUID +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MsoLogger -import org.camunda.bpm.engine.runtime.Execution -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64 -import org.springframework.web.util.UriUtils -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig - /** * This groovy class supports the <class>Delete3rdONAPE2EServiceInstance.bpmn</class> process. - * flow for Delete 3rdONAPE2EServiceInstance in 3rdONAP + * flow for Delete 3rdONAPE2EServiceInstance in 3rdONAP */ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcessor { @@ -79,50 +72,41 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso 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() - 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) - getSPPartnerInAAI(execution) - + String callSource = "UUI" String sppartnerUrl = "" if(execution.hasVariable(Prefix + "CallSource")) { callSource = execution.getVariable(Prefix + "CallSource") sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") } - - boolean is3rdONAPExist = false - if(!isBlank(sppartnerUrl)) { + + boolean is3rdONAPExist = false + if(!isBlank(sppartnerUrl)) { is3rdONAPExist = true } - + execution.setVariable("Is3rdONAPExist", is3rdONAPExist) execution.setVariable(Prefix + "ServiceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) - } catch (BpmnError e) { - throw e } catch (Exception ex){ String msg = "Exception in checkSPPartnerInfoFromAAI " + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void checkLocallCall (DelegateExecution execution) { msoLogger.info(" ***** Started checkLocallCall *****") - + boolean isLocalCall = true String callSource = execution.getVariable(Prefix + "CallSource") if("ExternalAPI".equalsIgnoreCase(callSource)) { @@ -136,7 +120,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String msg = "" try { - ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") + ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") String globalSubscriberId = resourceInputObj.getGlobalSubscriberId() if (isBlank(globalSubscriberId)) { @@ -154,15 +138,15 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } execution.setVariable("serviceType", serviceType) msoLogger.info( "serviceType:" + serviceType) - - String operationId = resourceInputObj.getOperationId() + + String operationId = resourceInputObj.getOperationId() if (isBlank(operationId)) { msg = "Input operationId is null" msoLogger.error( msg) } execution.setVariable("operationId", operationId) msoLogger.info( "operationId:" + operationId) - + String resourceName = resourceInputObj.getResourceInstanceName() if (isBlank(resourceName)) { msg = "Input resourceName is null" @@ -170,7 +154,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } execution.setVariable("resourceName", resourceName) msoLogger.info("resourceName:" + resourceName) - + String resourceTemplateId = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() if (isBlank(resourceTemplateId)) { msg = "Input resourceTemplateId is null" @@ -179,12 +163,10 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable("resourceTemplateId", resourceTemplateId) msoLogger.info( "resourceTemplateId:" + resourceTemplateId) - } catch (BpmnError e) { - throw e } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -223,11 +205,11 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso public void prepare3rdONAPRequest(DelegateExecution execution) { msoLogger.info(" ***** Started prepare3rdONAPRequest *****") - + String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") String extAPIPath = sppartnerUrl + '/serviceOrder' execution.setVariable("ExternalAPIURL", extAPIPath) - + // ExternalAPI message format String externalId = execution.getVariable("resourceName") String category = "E2E Service" @@ -245,10 +227,10 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String serviceName = "" String serviceType = execution.getVariable("serviceType") String serviceId = execution.getVariable(Prefix + "SppartnerId") - + queryServicefrom3rdONAP(execution) - String serviceSpecificationId = execution.getVariable(Prefix + "ServiceSpecificationId") - + String serviceSpecificationId = execution.getVariable(Prefix + "ServiceSpecificationId") + Map<String, String> valueMap = new HashMap<>() valueMap.put("externalId", '"' + externalId + '"') valueMap.put("category", '"' + category + '"') @@ -266,20 +248,21 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso valueMap.put("serviceId", '"' + serviceId + '"') valueMap.put("serviceName", "null") valueMap.put("serviceUuId", '"' + serviceSpecificationId + '"') - + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() - + valueMap.put("_requestInputs_", "") - + String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap) execution.setVariable(Prefix + "Payload", payload) msoLogger.info( "Exit " + prepare3rdONAPRequest) } - + private void queryServicefrom3rdONAP(DelegateExecution execution) { msoLogger.info(" ***** Started queryServicefrom3rdONAP *****") - + try { + String globalSubscriberId = execution.getVariable("globalSubscriberId") String SppartnerServiceId = execution.getVariable(Prefix + "SppartnerId") @@ -290,17 +273,17 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() - APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) + Response response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) - int responseCode = response.getStatusCode() + int responseCode = response.getStatus() execution.setVariable(Prefix + "GetServiceResponseCode", responseCode) msoLogger.debug("Get Service response code is: " + responseCode) - String extApiResponse = response.getResponseBodyAsString() + String extApiResponse = response.readEntity(String.class) - 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 ) { @@ -320,27 +303,30 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso 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") } - + }catch(Exception e) { + msoLogger.error("queryServicefrom3rdONAP exception:" + e.getMessage()) + } msoLogger.info( "Exit " + queryServicefrom3rdONAP) } public void doDeleteE2ESIin3rdONAP(DelegateExecution execution) { msoLogger.info(" ***** Started doDeleteE2ESIin3rdONAP *****") - + try { 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() + execution.setVariable("ServiceOrderId", "") - APIResponse response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload) + Response response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload) - int responseCode = response.getStatusCode() + int responseCode = response.getStatus() execution.setVariable(Prefix + "PostServiceOrderResponseCode", responseCode) msoLogger.debug("Post ServiceOrder response code is: " + responseCode) - String extApiResponse = response.getResponseBodyAsString() + String extApiResponse = response.readEntity(String.class) JSONObject responseObj = new JSONObject(extApiResponse) execution.setVariable(Prefix + "PostServiceOrderResponse", extApiResponse) @@ -358,33 +344,36 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } else{ 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") +// exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API") + } + }catch(Exception e) { + msoLogger.error("doDeleteE2ESIin3rdONAP exception:" + e.getMessage()) } - msoLogger.info( "Exit " + doDeleteE2ESIin3rdONAP) } - + public void getE2ESIProgressin3rdONAP(DelegateExecution execution) { msoLogger.info(" ***** Started getE2ESIProgressin3rdONAP *****") - + try { + String extAPIPath = execution.getVariable("ExternalAPIURL") extAPIPath += "/" + execution.getVariable("ServiceOrderId") msoLogger.debug("getE2ESIProgressin3rdONAP delete externalAPIURL is: " + extAPIPath) - + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() - APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) + Response response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) - int responseCode = response.getStatusCode() + int responseCode = response.getStatus() execution.setVariable(Prefix + "GetServiceOrderResponseCode", responseCode) msoLogger.debug("Get ServiceOrder response code is: " + responseCode) - String extApiResponse = response.getResponseBodyAsString() + String extApiResponse = response.readEntity(String.class) JSONObject responseObj = new JSONObject(extApiResponse) execution.setVariable(Prefix + "GetServiceOrderResponse", extApiResponse) - - utils.log("DEBUG", "getE2ESIProgressin3rdONAP delete response body is: " + extApiResponse, isDebugEnabled) + + utils.log("DEBUG", "getE2ESIProgressin3rdONAP delete response body is: " + extApiResponse) //Process Response //200 OK 201 CREATED 202 ACCEPTED if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) @@ -443,17 +432,22 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable("statusDescription", "Delete Service Order Status is unknown") } } - else{ + 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 Delete ServiceOrder Received a bad response") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Delete ServiceOrder Received a bad response from 3rdONAP External API") - } - +// exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Delete ServiceOrder Received a bad response from 3rdONAP External API") + } + }catch(Exception e) { + execution.setVariable("progress", 100) + execution.setVariable("status", "error") + execution.setVariable("statusDescription", "Get Delete ServiceOrder Exception") + msoLogger.error("getE2ESIProgressin3rdONAP exception:" + e.getMessage()) + } msoLogger.info( "Exit " + getE2ESIProgressin3rdONAP) } - + /** * delay 5 sec */ @@ -466,94 +460,65 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } private void getSPPartnerInAAI(DelegateExecution execution) { - msoLogger.info(" ***** Started getSPPartnerInAAI *****") - - 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) - msoLogger.debug(" Get sppartner response code is: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - aaiResponse = aaiResponse.replaceAll("&", "&") - execution.setVariable(Prefix + "GetSppartnerResponse", aaiResponse) + msoLogger.info(" ***** Started getSPPartnerInAAI *****") + try { + String id = execution.getVariable(Prefix + "SppartnerId") + + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SP_PARTNER, id) + SpPartner sp = client.get(uri).asBean(SpPartner.class).get() + + msoLogger.debug("GET sppartner Received a Good Response") + execution.setVariable(Prefix + "SuccessIndicator", true) + execution.setVariable(Prefix + "FoundIndicator", true) + +// String sppartnerId = sp.getSpPartnerId() +// execution.setVariable(Prefix + "SppartnerId", sppartnerId) +// msoLogger.debug(" SppartnerId is: " + sppartnerId) + String sppartnerUrl = sp.getUrl() + execution.setVariable(Prefix + "SppartnerUrl", sppartnerUrl) + msoLogger.debug(" SppartnerUrl is: " + sppartnerUrl) + String callSource = sp.getCallsource() + execution.setVariable(Prefix + "CallSource", callSource) + msoLogger.debug(" CallSource is: " + callSource) + String sppartnerVersion = sp.getResourceVersion() + execution.setVariable(Prefix + "SppartnerVersion", sppartnerVersion) + msoLogger.debug(" Resource Version is: " + sppartnerVersion) + } catch (Exception ex) { + String msg = "Exception in Delete3rdONAPE2EServiceInstance.saveSPPartnerInAAI. " + ex.getMessage() + msoLogger.debug(msg) +// throw new BpmnError("MSOWorkflowException") + } - //Process Response - if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) - //200 OK 201 CREATED 202 ACCEPTED - { - msoLogger.debug("GET sppartner Received a Good Response") - execution.setVariable(Prefix + "SuccessIndicator", true) - execution.setVariable(Prefix + "FoundIndicator", true) - - String sppartnerId = utils.getNodeText1(aaiResponse, "sp-partner-id") - execution.setVariable(Prefix + "SppartnerId", sppartnerId) - msoLogger.debug(" SppartnerId is: " + sppartnerId) - String sppartnerUrl = utils.getNodeText1(aaiResponse, "url") - execution.setVariable(Prefix + "SppartnerUrl", sppartnerUrl) - msoLogger.debug(" SppartnerUrl is: " + sppartnerUrl) - String callSource = utils.getNodeText1(aaiResponse, "callsource") - execution.setVariable(Prefix + "CallSource", callSource) - msoLogger.debug(" CallSource is: " + callSource) - String sppartnerVersion = utils.getNodeText1(aaiResponse, "resource-version") - execution.setVariable(Prefix + "SppartnerVersion", sppartnerVersion) - msoLogger.debug(" Resource Version is: " + sppartnerVersion) - } - else - { - msoLogger.debug("Get sppartner Received a Bad Response Code. Response Code is: " + responseCode) -// exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) -// throw new BpmnError("MSOWorkflowException") - } - msoLogger.info( "Exit " + getSPPartnerInAAI) } - + public void deleteSPPartnerInAAI(DelegateExecution execution) { msoLogger.info(" ***** Started deleteSPPartnerInAAI *****") - - String sppartnerId = execution.getVariable(Prefix + "SppartnerId") - String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") - String sppartnerVersion = execution.getVariable(Prefix + "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) - msoLogger.debug(" Get sppartner response code is: " + responseCode) + try { - String aaiResponse = response.getResponseBodyAsString() - aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - execution.setVariable(Prefix + "DeleteSppartnerResponse", aaiResponse) + String sppartnerId = execution.getVariable(Prefix + "SppartnerId") - //Process Response - if(responseCode == 200 || responseCode == 204 ) - { - msoLogger.debug("Delete sppartner Received a Good Response") - execution.setVariable(Prefix + "SuccessIndicator", true) - } - else if(responseCode == 404){ - msoLogger.debug(" Delete sppartner Received a Not Found (404) Response") - execution.setVariable(Prefix + "FoundIndicator", false) - } - else - { - msoLogger.debug("Delete sppartner Received a Bad Response Code. Response Code is: " + responseCode) -// exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) -// throw new BpmnError("MSOWorkflowException") - } + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SP_PARTNER, sppartnerId) + client.delete(uri) + msoLogger.debug("Delete sppartner Received a Good Response") + execution.setVariable(Prefix + "SuccessIndicator", true) + } catch (Exception ex) { + String msg = "Exception in Delete3rdONAPE2EServiceInstance.deleteSPPartnerInAAI. " + ex.getMessage() + msoLogger.debug(msg) +// 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") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) execution.setVariable("CVFMI_updateResOperStatusRequest", body) - } + } public void postProcess(DelegateExecution execution){ msoLogger.info(" ***** Started postProcess *****") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy index cbbc5189f4..519f064802 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy @@ -33,6 +33,7 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.MsoLogger import org.springframework.web.util.UriUtils; @@ -351,7 +352,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled) serviceId = UriUtils.encode(serviceId,"UTF-8") - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) 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 71ce28d7d3..28297976ff 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 @@ -7,9 +7,9 @@ * 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. @@ -27,26 +27,30 @@ import static org.apache.commons.lang3.StringUtils.*; import groovy.xml.XmlUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.aai.domain.yang.Device import org.onap.so.bpmn.common.recipe.ResourceInput; import org.onap.so.bpmn.common.resource.ResourceRequestBuilder +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder +import org.onap.so.client.HttpClient +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MsoLogger -import org.onap.so.rest.APIResponse import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import java.util.UUID; - +import javax.ws.rs.core.Response import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig -import org.onap.so.rest.APIResponse; -import org.onap.so.bpmn.common.scripts.AaiUtil +import javax.ws.rs.core.MediaType +import org.apache.commons.codec.binary.Base64 +import org.onap.so.utils.TargetEntity + /** * This groovy class supports the <class>DeleteDeviceResource.bpmn</class> process. @@ -95,53 +99,31 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) - } catch (BpmnError e) { - throw e; } catch (Exception ex){ String msg = "Exception in preProcessRequest " + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } private void getDeviceInAAI(DelegateExecution execution) { msoLogger.info(" ***** Started getDeviceInAAI *****") - + try { 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) - - } + + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.DEVICE, deviceId) + Device dev = client.get(uri).asBean(Device.class).get() + + String devClass = dev.getClass () + execution.setVariable(Prefix + "DeviceClass", devClass) + msoLogger.debug(" DeviceClass is: " + devClass) + + } catch (Exception ex){ + String msg = "Exception in getDeviceInAAI " + ex.getMessage() + msoLogger.debug(msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } msoLogger.info(" ***** Exit getDeviceInAAI *****") } @@ -161,12 +143,12 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { } catch (Exception ex){ String msg = "Exception in checkDevType " + ex.getMessage() msoLogger.debug( msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } private void setProgressUpdateVariables(DelegateExecution execution, String body) { - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) execution.setVariable("CVFMI_updateResOperStatusRequest", body) } @@ -213,7 +195,7 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { } catch (Exception ex){ String msg = "Exception in getVNFTemplatefromSDC " + ex.getMessage() msoLogger.debug( msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -226,7 +208,7 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { } catch (Exception ex){ String msg = "Exception in postVNFInfoProcess " + ex.getMessage() msoLogger.debug( msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -244,7 +226,7 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { } 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/DeleteGenericALaCarteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy index b43a96bdb0..ec2fed50c3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy @@ -200,6 +200,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro 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" @@ -209,8 +210,9 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro <action>DELETE</action> <source>${MsoUtils.xmlEscape(source)}</source> </request-info> - <aetgt:status-message>Service Instance was deleted successfully.</aetgt:status-message> - <aetgt:mso-bpel-name>DeleteGenericALaCarteServiceInstance</aetgt:mso-bpel-name> + <status-message>Service Instance was deleted successfully.</status-message> + <serviceInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</serviceInstanceId> + <mso-bpel-name>DeleteGenericALaCarteServiceInstance</mso-bpel-name> </aetgt:MsoCompletionRequest>""" // Format Response 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 3519bd7484..6456fc3a5d 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 @@ -27,8 +27,10 @@ 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.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.core.UrnPropertiesReader import org.onap.so.logger.MsoLogger import static org.apache.commons.lang3.StringUtils.* @@ -47,6 +49,8 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { JsonUtils jsonUtil = new JsonUtils() SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + MsoUtils msoUtils = new MsoUtils() public void preProcessRequest(DelegateExecution execution){ msoLogger.info(" ***** Started preProcessRequest *****") @@ -191,44 +195,44 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { 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.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(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.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <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> + <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> </onap-model-information> - <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-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> </service-information> <vnf-information> <vnf-id>$resourceInstnaceId</vnf-id> <vnf-type></vnf-type> <onap-model-information> - <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> + <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> </onap-model-information> </vnf-information> <vnf-request-input> @@ -249,33 +253,33 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { 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.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(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.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <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> + <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> </onap-model-information> - <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> <subscriber-name></subscriber-name> </service-information> <allotted-resource-information> @@ -283,11 +287,11 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { <allotted-resource-type></allotted-resource-type> <parent-service-instance-id></parent-service-instance-id> <onap-model-information> - <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> + <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> </onap-model-information> </allotted-resource-information> <connection-attachment-request-input> @@ -301,42 +305,42 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { 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.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <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:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEncode(source)}</source> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> <onap-model-information> - <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> + <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> </onap-model-information> - <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> </service-information> <network-information> <network-id>$resourceInstnaceId</network-id> <onap-model-information> - <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> + <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> </onap-model-information> </network-information> <network-request-input> @@ -361,7 +365,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { } private void setProgressUpdateVariables(DelegateExecution execution, String body) { - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) execution.setVariable("CVFMI_updateResOperStatusRequest", body) } @@ -384,13 +388,13 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <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> + <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> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; @@ -417,13 +421,13 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <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> + <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> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy index 98605fea8b..75db5db0dc 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy @@ -40,9 +40,6 @@ import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.common.scripts.CatalogDbUtils; import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.rest.APIResponse; -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig import java.util.List; import java.util.UUID; 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 ebd622ca51..40049515db 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 @@ -28,7 +28,6 @@ import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.ServiceInstance -import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.CatalogDbUtils; import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -46,7 +45,7 @@ import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger -import org.onap.so.rest.APIResponse + import org.springframework.web.util.UriUtils import org.onap.so.bpmn.core.UrnPropertiesReader @@ -461,10 +460,10 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { uuiRequest = ServicePluginFactory.getInstance().doProcessSiteLocation(serviceDecomposition, uuiRequest); execution.setVariable("uuiRequest", uuiRequest) execution.setVariable("serviceDecomposition", serviceDecomposition) - + msoLogger.trace("======== COMPLETED doProcessSiteLocation Process ======== ") } - + // Allocate cross link TPs(terminal points) for sotn network only public void doTPResourcesAllocation(DelegateExecution execution){ msoLogger.trace("======== Start doTPResourcesAllocation Process ======== ") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy index 82355beed2..4f00a64ecb 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy @@ -32,9 +32,6 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.rest.APIResponse; -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig import org.onap.so.logger.MsoLogger import org.onap.so.logger.MessageEnum import org.onap.so.bpmn.common.scripts.ExceptionUtil; 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 2167025e18..afdc5702d9 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 @@ -261,7 +261,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceModelInfo().getModelUuid(), requestAction) if (resourceRecipe != null) { - String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + resourceRecipe.getString("orchestrationUri") + String recipeURL = BPMNProperties.getProperty("bpelURL", "http://bpmn-infra:8081") + 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) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy index 38836c3650..6d41923bdf 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy @@ -94,6 +94,12 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { try { String requestId = execution.getVariable("msoRequestId") execution.setVariable("prefix", Prefix) + + def rollbackData = execution.getVariable("rollbackData") + if (rollbackData == null) { + rollbackData = new RollbackData() + } + execution.setVariable("rollbackData", rollbackData) setBasicDBAuthHeader(execution, isDebugEnabled) //Inputs @@ -409,7 +415,10 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex) { //start rollback set up - RollbackData rollbackData = new RollbackData() + def rollbackData = execution.getVariable("rollbackData") + if (rollbackData == null) { + rollbackData = new RollbackData() + } def disableRollback = execution.getVariable("disableRollback") rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString()) rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true") @@ -506,11 +515,13 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { def sdncRequestId3 = UUID.randomUUID().toString() String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId2}<", ">${sdncRequestId3}<") def rollbackData = execution.getVariable("rollbackData") - rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", sdncDeactivate) - rollbackData.put("SERVICEINSTANCE", "sdncDelete", sdncDelete) - execution.setVariable("rollbackData", rollbackData) + if (rollbackData != null) { + rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", sdncDeactivate) + rollbackData.put("SERVICEINSTANCE", "sdncDelete", sdncDelete) + execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + } } catch (BpmnError e) { throw e; @@ -541,8 +552,10 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { msoLogger.debug("Good response from SDNC Adapter for service-instance topology assign: \n" + response) def rollbackData = execution.getVariable("rollbackData") - rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true") - execution.setVariable("rollbackData", rollbackData) + if (rollbackData != null) { + rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true") + execution.setVariable("rollbackData", rollbackData) + } }else{ msoLogger.debug("Bad Response from SDNC Adapter for service-instance assign") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy index 10f6acd403..a3c30dcb50 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy @@ -7,9 +7,9 @@ * 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. @@ -18,25 +18,24 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.infrastructure.scripts; +package org.onap.so.bpmn.infrastructure.scripts -import static org.apache.commons.lang3.StringUtils.*; - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -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.UrnPropertiesReader; -import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.HttpClient import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger -import org.onap.so.rest.APIResponse -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig + +import org.onap.so.utils.TargetEntity import groovy.json.* +import javax.ws.rs.core.Response /** * This groovy class supports the <class>DoCreateVFCNetworkServiceInstance.bpmn</class> process. @@ -46,9 +45,9 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVFCNetworkServiceInstance.class); String vfcUrl = "/vfc/rest/v1/vfcadapter" - + String host = "http://mso.mso.testlab.openecomp.org:8080" - + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -100,7 +99,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces }""" execution.setVariable("nsOperationKey", nsOperationKey); execution.setVariable("nsParameters", nsParameters) - + } catch (BpmnError e) { throw e; @@ -127,9 +126,9 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces "nsOperationKey":${nsOperationKey}, "nsParameters":${nsParameters} }""" - APIResponse apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() + Response apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody) + String returnCode = apiResponse.getStatus() + String aaiResponseAsString = apiResponse.readEntity(String.class) String nsInstanceId = ""; if(returnCode== "200" || returnCode == "201"){ nsInstanceId = jsonUtil.getJsonValue(aaiResponseAsString, "nsInstanceId") @@ -155,9 +154,9 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces }""" String nsInstanceId = execution.getVariable("nsInstanceId") String url = host + vfcUrl + "/ns/" +nsInstanceId + "/instantiate" - APIResponse apiResponse = postRequest(execution, url, reqBody) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() + Response apiResponse = postRequest(execution, url, reqBody) + String returnCode = apiResponse.getStatus() + String aaiResponseAsString = apiResponse.readEntity(String.class) String jobId = ""; if(returnCode== "200"|| returnCode == "201"){ jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") @@ -174,9 +173,9 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces String jobId = execution.getVariable("jobId") String nsOperationKey = execution.getVariable("nsOperationKey"); String url = host + vfcUrl + "/jobs/" + jobId - APIResponse apiResponse = postRequest(execution, url, nsOperationKey) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() + Response apiResponse = postRequest(execution, url, nsOperationKey) + String returnCode = apiResponse.getStatus() + String aaiResponseAsString = apiResponse.readEntity(String.class) String operationStatus = "error" if(returnCode== "200"|| returnCode == "201"){ operationStatus = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.status") @@ -186,12 +185,12 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces } /** - * delay 5 sec + * delay 5 sec */ public void timeDelay(DelegateExecution execution) { try { Thread.sleep(5000); - } catch(InterruptedException e) { + } catch(InterruptedException e) { msoLogger.debug("Time Delay exception" + e ) } } @@ -209,53 +208,17 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces String globalSubscriberId = execution.getVariable("globalSubscriberId") String serviceType = execution.getVariable("serviceType") String serviceId = execution.getVariable("serviceId") - String addRelationPayload = """<relationship xmlns="http://org.openecomp.aai.inventory/v11"> - <related-to>service-instance</related-to> - <related-link>/aai/v11/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${nsInstanceId}</related-link> - <relationship-data> - <relationship-key>customer.global-customer-id</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(globalSubscriberId)}</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>service-subscription.service-type</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(serviceType)}</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>service-instance.service-instance-id</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(nsInstanceId)}</relationship-value> - </relationship-data> - </relationship>""" - String endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - msoLogger.debug("Add Relationship req:\n" + addRelationPayload) - String url = endpoint + "/aai/v11/business/customers/customer/" + globalSubscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances/service-instance/" + serviceId + "/relationship-list/relationship" - APIResponse aaiRsp = executeAAIPutCall(execution, url, addRelationPayload) - msoLogger.debug("aai response status code:" + aaiRsp.getStatusCode()) - msoLogger.debug("aai response content:" + aaiRsp.getResponseBodyAsString()) - msoLogger.trace("Exit addNSRelationship") - } - - public APIResponse executeAAIPutCall(DelegateExecution execution, String url, String payload){ - msoLogger.trace("Started Execute AAI Put Process") - APIResponse apiResponse = null + + AAIResourceUri nsUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,globalSubscriberId,serviceType,nsInstanceId) + AAIResourceUri relatedServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,globalSubscriberId,serviceType,serviceId) + try{ - String uuid = utils.getRequestID() - msoLogger.debug("Generated uuid is: " + uuid) - msoLogger.debug("URL to be used is: " + url) - String userName = UrnPropertiesReader.getVariable("aai.auth", execution) - String password = UrnPropertiesReader.getVariable("mso.msoKey", execution) - String basicAuthCred = utils.getBasicAuth(userName,password) - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - apiResponse = client.httpPut(payload) - msoLogger.trace("Completed Execute AAI Put Process") + getAAIClient().connect(nsUri,relatedServiceUri) + msoLogger.info("NS relationship to Service added successfully") }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Put Call", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Put Call", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); throw new BpmnError("MSOWorkflowException") } - return apiResponse } /** @@ -263,20 +226,26 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces * url: the url of the request * requestBody: the body of the request */ - private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){ + private Response postRequest(DelegateExecution execution, String urlString, String requestBody){ msoLogger.trace("Started Execute VFC adapter Post Process") - msoLogger.debug("url:"+url +"\nrequestBody:"+ requestBody) - APIResponse apiResponse = null + msoLogger.debug("url:"+urlString +"\nrequestBody:"+ requestBody) + Response apiResponse = null try{ - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); - apiResponse = client.httpPost(requestBody) - msoLogger.debug("response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString()) + + URL url = new URL(urlString); + + HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER) + httpClient.addAdditionalHeader("Accept", "application/json") + httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk") + + apiResponse = httpClient.post(requestBody) + + msoLogger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) msoLogger.trace("Completed Execute VF-C adapter Post Process") }catch(Exception e){ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Post Call", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); throw new BpmnError("MSOWorkflowException") - } + } return apiResponse } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy index 238ac82c01..b30929d6bd 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy @@ -503,7 +503,9 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess resourceTemplateUUIDs = resourceTemplateUUIDs + it.resourceInstanceId + ":" } } - execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) + execution.setVariable("URN_mso_adapters_openecomp_db_endpoint", dbAdapterEndpoint) String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy index 21bf0f2c5c..59ea5c236f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy @@ -20,27 +20,29 @@ */ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.aai.domain.yang.AllottedResource + +import javax.ws.rs.core.UriBuilder + import static org.apache.commons.lang3.StringUtils.*; 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.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.json.JsonUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger -import org.onap.so.rest.APIResponse; + import org.springframework.web.util.UriUtils; import org.onap.so.client.aai.AAIResourcesClient import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.Relationships import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.json.JSONObject @@ -371,19 +373,15 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce if (StringUtils.equalsIgnoreCase(relatedTo, "allotted-resource")) { msoLogger.info("allotted-resource exists ") - String aaiArRsp = getAaiAr(execution, relatedLink) + Optional<AllottedResource> aaiArRsp = getAaiAr(execution, relatedLink) msoLogger.info("aaiArRsp: " + aaiArRsp) - if (! isBlank(aaiArRsp)) { - def type = utils.getNodeText(aaiArRsp, "type") - def id = utils.getNodeText(aaiArRsp, "id") - def role = utils.getNodeText(aaiArRsp, "role") - def resourceVersion = utils.getNodeText(aaiArRsp, "resource-version") + if (aaiArRsp.isPresent()) { JSONObject jObject = new JSONObject() - jObject.put("resourceType", type) - jObject.put("resourceInstanceId", id) - jObject.put("resourceRole", role) - jObject.put("resourceVersion", resourceVersion) + jObject.put("resourceType", aaiArRsp.get().getType()) + jObject.put("resourceInstanceId", aaiArRsp.get().getId()) + jObject.put("resourceRole", aaiArRsp.get().getRole()) + jObject.put("resourceVersion", aaiArRsp.get().getResourceVersion()) allResources.put(jObject) msoLogger.info("allResources: " + allResources) @@ -577,27 +575,11 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce msoLogger.info("Exited " + method) } - private String getAaiAr(DelegateExecution execution, String relink) { + private Optional<AllottedResource> getAaiAr(DelegateExecution execution, String relink) { def method = getClass().getSimpleName() + '.getAaiAr(' +'execution=' + execution.getId() +')' msoLogger.info("Entered " + method) - AaiUtil aaiUtil = new AaiUtil(this) - String aaiEndpoint = execution.getVariable("URN_aai_endpoint") + relink - - msoLogger.debug("get AR info " + aaiEndpoint) - APIResponse response = aaiUtil.executeAAIGetCall(execution, aaiEndpoint) - - int responseCode = response.getStatusCode() - msoLogger.debug("get AR info responseCode:" + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - msoLogger.debug("get AR info " + aaiResponse) - - if(responseCode < 200 || responseCode >= 300 || isBlank(aaiResponse)) { - return null - } - - msoLogger.info("Exited " + method) - return aaiResponse + AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(relink).build()) + return getAAIClient().get(AllottedResource.class,uri) } /** * prepare Decompose next resource to create request @@ -930,12 +912,10 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce execution.setVariable("operationId", operationId) execution.setVariable("operationType", operationType) - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) - execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") - String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://org.onap.so/requestsdb"> @@ -1002,7 +982,8 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce } } } - def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" + + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) 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 66bd1ece90..a981abf011 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 @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.scripts import static org.apache.commons.lang3.StringUtils.*; +import javax.ws.rs.core.Response import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory @@ -29,16 +30,19 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray 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.rest.APIResponse +import org.onap.so.bpmn.core.UrnPropertiesReader + +import org.onap.so.utils.TargetEntity import org.onap.so.bpmn.core.json.JsonUtils -import org.springframework.web.util.UriUtils; +import org.onap.so.client.HttpClient +import org.springframework.web.util.UriUtils import org.w3c.dom.Document import org.w3c.dom.Element import org.w3c.dom.Node @@ -207,7 +211,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } execution.setVariable("serviceRelationShip", jArray.toString()) - + // //test(siData) // NodeList nodeList = serviceXml.getElementsByTagName("relationship") // JSONArray jArray = new JSONArray() @@ -276,8 +280,8 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { // } // // for SP-Partner // }else if (e.equals("sp-partner")){ -// -// } +// +// } // } // } // execution.setVariable("serviceRelationShip", jArray.toString()) @@ -311,16 +315,16 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) } - + private JSONObject getRelationShipData(node, isDebugEnabled){ JSONObject jObj = new JSONObject() - + def relation = utils.nodeToString(node) def rt = utils.getNodeText(relation, "related-to") - + def rl = utils.getNodeText(relation, "related-link") utils.log("INFO", "ServiceInstance Related NS/Configuration :" + rl, isDebugEnabled) - + def rl_datas = utils.getIdenticalChildren(node, "relationship-data") for(def rl_data : rl_datas) { def eKey = utils.getChildNodeText(rl_data, "relationship-key") @@ -398,7 +402,7 @@ 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()) { @@ -408,26 +412,30 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { 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") + utils.log("INFO"," ***** Started getRelatedResourceInAAI *****", isDebugEnabled) + +// AaiUtil aaiUriUtil = new AaiUtil() +// String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) String urlLink = jObj.get("resourceLinkUrl") String serviceAaiPath = "${aai_endpoint}${urlLink}" - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceAaiPath) - int responseCode = response.getStatusCode() + + URL url = new URL(serviceAaiPath) + HttpClient client = new HttpClient(url, "application/xml", TargetEntity.AAI) + + + Response response = client.get() + int responseCode = response.getStatus() 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("&", "&") + String aaiResponse = response.readEntity(String.class) execution.setVariable(Prefix + "GetRelatedResourceResponse", aaiResponse) - + //Process Response if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) //200 OK 201 CREATED 202 ACCEPTED @@ -435,9 +443,9 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { 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 = "" @@ -447,19 +455,19 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { modelUuid = jObj.get("model-version-id") modelCustomizationId = jObj.get("model-customization-id") } - - jObj.put("modelInvariantId", modelInvariantId) - jObj.put("modelVersionId", modelUuid) + + 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("ERROR", "Get RelatedResource Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled) } - + utils.log("INFO", " ***** Exit getRelatedResourceInAAI *****", isDebugEnabled) - return jObj; - + return jObj; + } public void postDecomposeService(DelegateExecution execution) { @@ -491,7 +499,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { relationShipList.each { JSONObject obj = getRelatedResourceInAAI(execution, (JSONObject)it) - + for (Resource resource : deleteResourceList) { String modelName = resource.getModelInfo().getModelName() @@ -508,10 +516,16 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } } } - } + } // only delete real existing resources execution.setVariable("deleteResourceList", deleteRealResourceList) + + boolean isDeleteResourceListValid = false + if(deleteRealResourceList.size() > 0) { + isDeleteResourceListValid = true + } + execution.setVariable("isDeleteResourceListValid", isDeleteResourceListValid) utils.log("DEBUG", "delete resource list : " + deleteRealResourceList, isDebugEnabled) } catch (Exception ex) { @@ -547,8 +561,8 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" } - - execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) + execution.setVariable("URN_mso_adapters_openecomp_db_endpoint", dbAdapterEndpoint) String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" @@ -575,6 +589,53 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) } + + public void prepareUpdateServiceOperationStatus(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " ======== STARTED prepareUpdateServiceOperationStatus Process ======== ", isDebugEnabled) + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String userId = "" + String result = execution.getVariable("result") + String progress = execution.getVariable("progress") + String reason = "" + String operationContent = execution.getVariable("operationContent") + + serviceId = UriUtils.encode(serviceId,"UTF-8") + + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + + String payload = + """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:updateServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb"> + <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId> + <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> + <operationType>DELETE</operationType> + <userId>${MsoUtils.xmlEscape(userId)}</userId> + <result>${MsoUtils.xmlEscape(result)}</result> + <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent> + <progress>${MsoUtils.xmlEscape(progress)}</progress> + <reason>${MsoUtils.xmlEscape(reason)}</reason> + </ns:updateServiceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) + utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing prepareUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateServiceOperationStatus Method:\n" + e.getMessage()) + } + utils.log("DEBUG", "======== COMPLETED prepareUpdateServiceOperationStatus Process ======== ", isDebugEnabled) + } /** * post config request. 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 cf0bd3f6fe..122cc08e89 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 @@ -39,6 +39,7 @@ import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.infrastructure.properties.BPMNProperties import org.onap.so.logger.MsoLogger @@ -213,14 +214,19 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") int currentIndex = execution.getVariable("currentResourceIndex") - Resource curResource = sequencedResourceList.get(currentIndex); - - String resourceInstanceUUID = curResource.getResourceId() - String resourceTemplateUUID = curResource.getModelInfo().getModelUuid() - execution.setVariable("resourceInstanceId", resourceInstanceUUID) - execution.setVariable("currentResource", curResource) - utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " - + resourceInstanceUUID + " resourceModelName: " + curResource.getModelInfo().getModelName(), isDebugEnabled) + if(sequencedResourceList != null && sequencedResourceList.size() > currentIndex){ + Resource curResource = sequencedResourceList.get(currentIndex); + + String resourceInstanceUUID = curResource.getResourceId() + String resourceTemplateUUID = curResource.getModelInfo().getModelUuid() + execution.setVariable("resourceInstanceId", resourceInstanceUUID) + execution.setVariable("currentResource", curResource) + utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + + resourceInstanceUUID + " resourceModelName: " + curResource.getModelInfo().getModelName(), isDebugEnabled) + } + else { + execution.setVariable("resourceInstanceId", "") + } utils.log("INFO", " ======== END preResourceDelete Process ======== ", isDebugEnabled) } @@ -320,7 +326,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { </soapenv:Body> </soapenv:Envelope>"""; - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) execution.setVariable("CVFMI_updateResOperStatusRequest", body) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy index 0069bf4f0a..d855479694 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy @@ -7,9 +7,9 @@ * 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. @@ -18,25 +18,22 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.infrastructure.scripts; +package org.onap.so.bpmn.infrastructure.scripts -import static org.apache.commons.lang3.StringUtils.* - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -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.json.JsonUtils +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.HttpClient +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger -import org.onap.so.rest.APIResponse -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig - -import groovy.json.* +import org.onap.so.utils.TargetEntity +import javax.ws.rs.core.Response /** * This groovy class supports the <class>DoDeleteVFCNetworkServiceInstance.bpmn</class> process. * flow for E2E ServiceInstance Delete @@ -44,11 +41,11 @@ import groovy.json.* public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProcessor { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVFCNetworkServiceInstance.class); - + String vfcUrl = "/vfc/rest/v1/vfcadapter" - + String host = "http://mso.mso.testlab.openecomp.org:8080" - + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -110,55 +107,14 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces String globalSubscriberId = execution.getVariable("globalSubscriberId") String serviceType = execution.getVariable("serviceType") String serviceId = execution.getVariable("serviceId") - String deleteRelationPayload = """<relationship xmlns="http://org.openecomp.aai.inventory/v11"> - <related-to>service-instance</related-to> - <related-link>/aai/v11/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${nsInstanceId}</related-link> - <relationship-data> - <relationship-key>customer.global-customer-id</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(globalSubscriberId)}</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>service-subscription.service-type</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(serviceType)}</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>service-instance.service-instance-id</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(nsInstanceId)}</relationship-value> - </relationship-data> - </relationship>""" - String endpoint = execution.getVariable("URN_aai_endpoint") - utils.log("INFO","Delete Relationship req:\n" + deleteRelationPayload, isDebugEnabled) - String url = endpoint + "/aai/v11/business/customers/customer/" + globalSubscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances/service-instance/" + serviceId + "/relationship-list/relationship" - - APIResponse aaiRsp = executeAAIDeleteCall(execution, url, deleteRelationPayload) - utils.log("INFO","aai response status code:" + aaiRsp.getStatusCode(), isDebugEnabled) - utils.log("INFO","aai response content:" + aaiRsp.getResponseBodyAsString(), isDebugEnabled) - utils.log("INFO"," *****Exit deleteNSRelationship *****", isDebugEnabled) - } - - public APIResponse executeAAIDeleteCall(DelegateExecution execution, String url, String payload){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled) - APIResponse apiResponse = null - try{ - String uuid = utils.getRequestID() - utils.log("INFO","Generated uuid is: " + uuid, isDebugEnabled) - utils.log("INFO","URL to be used is: " + url, isDebugEnabled) - String userName = execution.getVariable("URN_aai_auth") - String password = execution.getVariable("URN_mso_msoKey") - String basicAuthCred = utils.getBasicAuth(userName,password) - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - apiResponse = client.httpDelete(payload) - utils.log("INFO","======== Completed Execute AAI Delete Process ======== ", isDebugEnabled) + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceId) + AAIResourceUri nsServiceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nsInstanceId) + try { + getAAIClient().disconnect(serviceInstanceUri, nsServiceInstanceUri) }catch(Exception e){ - utils.log("ERROR","Exception occured while executing AAI Put Call. Exception is: \n" + e, isDebugEnabled) - throw new BpmnError("MSOWorkflowException") + exceptionUtil.buildAndThrowWorkflowException(execution,25000,"Exception occured while NS disconnect call: " + e.getMessage()) } - return apiResponse + utils.log("INFO"," *****Exit deleteNSRelationship *****", isDebugEnabled) } /** @@ -168,16 +124,15 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces msoLogger.trace("deleteNetworkService start ") String nsOperationKey = execution.getVariable("nsOperationKey"); - String url = host + vfcUrl + "/ns/" + execution.getVariable("nsInstanceId") - APIResponse apiResponse = deleteRequest(execution, url, nsOperationKey) - String returnCode = apiResponse.getStatusCode() - String apiResponseAsString = apiResponse.getResponseBodyAsString() + String url = host + vfcUrl + "/ns/" + execution.getVariable("nsInstanceId") + Response apiResponse = deleteRequest(execution, url, nsOperationKey) + String returnCode = apiResponse.getStatus() String operationStatus = "error"; if(returnCode== "200" || returnCode== "202"){ operationStatus = "finished" } execution.setVariable("operationStatus", operationStatus) - + msoLogger.trace("deleteNetworkService end ") } @@ -187,16 +142,16 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces public void terminateNetworkService(DelegateExecution execution) { msoLogger.trace("terminateNetworkService start ") - String nsOperationKey = execution.getVariable("nsOperationKey") + String nsOperationKey = execution.getVariable("nsOperationKey") String url = host + vfcUrl + "/ns/" + execution.getVariable("nsInstanceId") + "/terminate" - APIResponse apiResponse = postRequest(execution, url, nsOperationKey) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() + Response apiResponse = postRequest(execution, url, nsOperationKey) + String returnCode = apiResponse.getStatus() + String aaiResponseAsString = apiResponse.readEntity(String.class) String jobId = ""; if(returnCode== "200" || returnCode== "202"){ jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") } - execution.setVariable("jobId", jobId) + execution.setVariable("jobId", jobId) msoLogger.trace("terminateNetworkService end ") } @@ -208,10 +163,10 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces msoLogger.trace("queryNSProgress start ") String jobId = execution.getVariable("jobId") String nsOperationKey = execution.getVariable("nsOperationKey"); - String url = host + vfcUrl + "/jobs/" + execution.getVariable("jobId") - APIResponse apiResponse = postRequest(execution, url, nsOperationKey) - String returnCode = apiResponse.getStatusCode() - String apiResponseAsString = apiResponse.getResponseBodyAsString() + String url = host + vfcUrl + "/jobs/" + execution.getVariable("jobId") + Response apiResponse = postRequest(execution, url, nsOperationKey) + String returnCode = apiResponse.getStatus() + String apiResponseAsString = apiResponse.readEntity(String.class) String operationProgress = "100" if(returnCode== "200"){ operationProgress = jsonUtil.getJsonValue(apiResponseAsString, "responseDescriptor.progress") @@ -221,12 +176,12 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces } /** - * delay 5 sec + * delay 5 sec */ public void timeDelay(DelegateExecution execution) { try { Thread.sleep(5000); - } catch(InterruptedException e) { + } catch(InterruptedException e) { msoLogger.info("Time Delay exception" + e) } } @@ -243,21 +198,27 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces * url: the url of the request * requestBody: the body of the request */ - private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){ + private Response postRequest(DelegateExecution execution, String urlString, String requestBody){ - msoLogger.trace("Started Execute VFC adapter Post Process ") - msoLogger.info("url:"+url +"\nrequestBody:"+ requestBody) - APIResponse apiResponse = null - try{ - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk");; - apiResponse = client.httpPost(requestBody) - msoLogger.info("response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString()) - msoLogger.trace("Completed Execute VF-C adapter Post Process ") - }catch(Exception e){ + msoLogger.trace("Started Execute VFC adapter Post Process ") + msoLogger.info("url:"+urlString +"\nrequestBody:"+ requestBody) + Response apiResponse = null + try{ + URL url = new URL(urlString); + + HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER) + httpClient.addAdditionalHeader("Accept", "application/json") + httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk") + + apiResponse = httpClient.post(requestBody) + + msoLogger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) + + msoLogger.trace("Completed Execute VF-C adapter Post Process ") + }catch(Exception e){ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing VF-C Post Call. Exception is: \n" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); throw new BpmnError("MSOWorkflowException") - } + } return apiResponse } /** @@ -265,21 +226,24 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces * url: the url of the request * requestBody: the body of the request */ - private APIResponse deleteRequest(DelegateExecution execution, String url, String requestBody){ + private Response deleteRequest(DelegateExecution execution, String url, String requestBody){ - msoLogger.trace("Started Execute VFC adapter Delete Process ") + msoLogger.trace("Started Execute VFC adapter Delete Process ") msoLogger.info("url:"+url +"\nrequestBody:"+ requestBody) - APIResponse apiResponse = null + Response r try{ - RESTConfig config = new RESTConfig(url); - RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); - apiResponse = client.httpDelete(requestBody) - msoLogger.info("response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString()) - msoLogger.trace("Completed Execute VF-C adapter Delete Process ") + + URL Url = new URL(url) + HttpClient httpClient = new HttpClient(Url, "application/json", TargetEntity.VNF_ADAPTER) + httpClient.addAdditionalHeader("Accept", "application/json") + httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk") + r = httpClient.delete(requestBody) + + msoLogger.trace("Completed Execute VF-C adapter Delete Process ") }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing VF-C Post Call. Exception is: \n" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing VF-C Post Call. Exception is: \n" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); throw new BpmnError("MSOWorkflowException") - } - return apiResponse + } + return r } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy index e06e5238c6..a99f6e993e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy @@ -7,9 +7,9 @@ * 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. @@ -31,12 +31,10 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution import com.fasterxml.jackson.databind.ObjectMapper - -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig -import org.onap.so.rest.APIResponse; +import javax.ws.rs.core.Response import org.onap.so.bpmn.infrastructure.vfcmodel.ScaleResource +import org.onap.so.client.HttpClient import org.onap.so.bpmn.infrastructure.vfcmodel.ScaleNsByStepsData import org.onap.so.bpmn.infrastructure.vfcmodel.ScaleNsData @@ -47,6 +45,7 @@ import org.onap.so.bpmn.infrastructure.vfcmodel.NsParameters import org.onap.so.bpmn.infrastructure.vfcmodel.LocationConstraint import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.onap.so.utils.TargetEntity @@ -114,10 +113,10 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess String url = host + scaleUrl.replaceAll("\\{nsInstanceId\\}", nsInstanceId) - APIResponse apiResponse = postRequest(execution, url, reqBody) + Response apiResponse = postRequest(execution, url, reqBody) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() + String returnCode = apiResponse.getStatus() + String aaiResponseAsString = apiResponse.readEntity(String.class) String jobId = "" if (returnCode == "200" || returnCode == "202") { jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") @@ -156,10 +155,10 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess nsOperationKey.setOperationId(execution.getVariable("operationId")) String queryReqBody = objectToJsonStr(nsOperationKey) - APIResponse apiResponse = postRequest(execution,url, queryReqBody) + Response apiResponse = postRequest(execution,url, queryReqBody) - String returnCode = apiResponse.getStatusCode() - String aaiResponseAsString = apiResponse.getResponseBodyAsString() + String returnCode = apiResponse.getStatus() + String aaiResponseAsString = apiResponse.readEntity(String.class) String operationStatus = "error" @@ -195,16 +194,19 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess * url: the url of the request * requestBody: the body of the request */ - private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){ + private Response postRequest(DelegateExecution execution, String urlString, String requestBody){ msoLogger.trace("Started Execute VFC adapter Post Process ") - msoLogger.info("url:"+url +"\nrequestBody:"+ requestBody) - APIResponse apiResponse = null + msoLogger.info("url:"+urlString +"\nrequestBody:"+ requestBody) + Response apiResponse = null try{ - RESTConfig config = new RESTConfig(url) - RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk") -// RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk") - apiResponse = client.httpPost(requestBody) - msoLogger.info("response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString()) + URL url = new URL(urlString); + + HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER) + httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk") + + apiResponse = httpClient.post(requestBody) + + msoLogger.info("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) msoLogger.trace("Completed Execute VF-C adapter Post Process ") }catch(Exception e){ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing VFC Post Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy index 5b7fdb2c22..2c539a1022 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy @@ -17,14 +17,16 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.infrastructure.scripts; +package org.onap.so.bpmn.infrastructure.scripts +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri; import static org.apache.commons.lang3.StringUtils.*; import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.aai.domain.yang.ServiceInstance; import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils @@ -167,7 +169,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" } - def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy index 3a309cf5a2..687ac215a5 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy @@ -29,6 +29,7 @@ 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.json.JsonUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger import org.onap.so.utils.UUIDChecker @@ -259,7 +260,7 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor execution.setVariable("operationId", operationId) execution.setVariable("operationType", operationType) - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy index 20ced72002..4127c3a913 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy @@ -36,6 +36,7 @@ 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.json.JsonUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.AAIResourcesClient import org.onap.so.client.aai.entities.AAIResultWrapper @@ -152,8 +153,6 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor execution.setVariable("operationType", "update") execution.setVariable("hasResourcetoUpdate", false) - execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") - } catch (BpmnError e) { throw e; } catch (Exception ex){ @@ -247,7 +246,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor execution.setVariable("operationId", operationId) execution.setVariable("operationType", operationType) - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) @@ -308,11 +307,10 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor execution.setVariable("operationId", operationId) execution.setVariable("operationType", operationType) - def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) - execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://org.onap.so/requestsdb"> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy index b7f31d7823..0f9a0ad292 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy @@ -29,10 +29,13 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.VfModuleBase import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.constants.Defaults import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger import org.onap.so.rest.APIResponse -import org.springframework.web.util.UriUtils class UpdateVfModuleVolume extends VfModuleBase { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVfModuleVolume.class); @@ -172,14 +175,15 @@ class UpdateVfModuleVolume extends VfModuleBase { try { def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') - def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + - '/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/' + UriUtils.encode(aicCloudRegion, "UTF-8") + - '/volume-groups/volume-group/' + UriUtils.encode(volumeGroupId, "UTF-8") + + AaiUtil aaiUtil = new AaiUtil(this) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), aicCloudRegion, volumeGroupId) + String endPoint = aaiUtil.createAaiUri(uri) + msoLogger.debug('Sending GET to AAI endpoint \'' + endPoint + '\'') msoLogger.debug("UpdateVfModuleVolume sending GET for quering AAI endpoint: " + endPoint) - AaiUtil aaiUtil = new AaiUtil(this) APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint) def int statusCode = response.getStatusCode() def responseData = response.getResponseBodyAsString() 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 beac679691..187189c694 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 @@ -176,17 +176,30 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable("subscriberInfo", subscriberInfo) msoLogger.debug("Incoming subscriberInfo is: " + subscriberInfo) - // extract cloud configuration, split vid_ID into cloudOwner and cloudRegionId + // extract cloud configuration - if underscore "_" is present treat as vimId else it's a cloudRegion String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId") - def cloudRegion = vimId.split("_") - def cloudOwner = cloudRegion[0].toString() - def cloudRegionId = cloudRegion[1].toString() - execution.setVariable("cloudOwner", cloudOwner) - utils.log("DEBUG","cloudOwner: " + cloudOwner, isDebugEnabled) - execution.setVariable("cloudRegionId", cloudRegionId) - utils.log("DEBUG","cloudRegionId: " + cloudRegionId, isDebugEnabled) - + if (vimId.contains("_") && vimId.split("_").length == 2 ) { + def cloudRegion = vimId.split("_") + def cloudOwner = cloudRegion[0] + def cloudRegionId = cloudRegion[1] + execution.setVariable("cloudOwner", cloudOwner) + msoLogger.debug("cloudOwner: " + cloudOwner) + execution.setVariable("cloudRegionId", cloudRegionId) + msoLogger.debug("cloudRegionId: " + cloudRegionId) + } else { + msoLogger.debug("vimId is not present - setting cloudRegion/cloudOwner from request.") + String cloudOwner = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.cloudConfiguration.cloudOwner") + if (!cloudOwner?.empty && cloudOwner != "") + { + execution.setVariable("cloudOwner", cloudOwner) + msoLogger.debug("cloudOwner: " + cloudOwner) + } + def cloudRegionId = vimId + execution.setVariable("cloudRegionId", cloudRegionId) + msoLogger.debug("cloudRegionId: " + cloudRegionId) + } /* * Extracting User Parameters from incoming Request and converting into a Map */ @@ -237,6 +250,10 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable("callHoming", true) inputMap.put("Homing_Solution", userParam.value) } + if ("Orchestrator".equalsIgnoreCase(userParam?.name)) { + execution.setVariable("orchestrator", userParam.value) + inputMap.put("orchestrator", userParam.value) + } } } @@ -592,16 +609,32 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString) - // extract cloud configuration + // extract cloud configuration - if underscore "_" is present treat as vimId else it's a cloudRegion String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId") - def cloudRegion = vimId.split("_") - execution.setVariable("cloudOwner", cloudRegion[0]) - msoLogger.debug("cloudOwner: "+ cloudRegion[0]) - execution.setVariable("cloudRegionId", cloudRegion[1]) - msoLogger.debug("cloudRegionId: "+ cloudRegion[1]) - execution.setVariable("lcpCloudRegionId", cloudRegion[1]) - msoLogger.debug("lcpCloudRegionId: "+ cloudRegion[1]) + if (vimId.contains("_") && vimId.split("_").length == 2 ) { + def cloudRegion = vimId.split("_") + execution.setVariable("cloudOwner", cloudRegion[0]) + msoLogger.debug("cloudOwner: " + cloudRegion[0]) + execution.setVariable("cloudRegionId", cloudRegion[1]) + msoLogger.debug("cloudRegionId: " + cloudRegion[1]) + execution.setVariable("lcpCloudRegionId", cloudRegion[1]) + msoLogger.debug("lcpCloudRegionId: " + cloudRegion[1]) + } else { + msoLogger.debug("vimId is not present - setting cloudRegion/cloudOwner from request.") + String cloudOwner = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.cloudConfiguration.cloudOwner") + if (!cloudOwner?.empty && cloudOwner != "") + { + execution.setVariable("cloudOwner", cloudOwner) + msoLogger.debug("cloudOwner: " + cloudOwner) + } + execution.setVariable("cloudRegionId", vimId) + msoLogger.debug("cloudRegionId: " + vimId) + execution.setVariable("lcpCloudRegionId", vimId) + msoLogger.debug("lcpCloudRegionId: " + vimId) + } + String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.tenantId") execution.setVariable("tenantId", tenantId) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy index 3c08779513..723bfd54d7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy @@ -240,11 +240,9 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ if(obj.has("result-data")){ JSONObject ob = obj.getJSONArray("result-data").getJSONObject(0) String resourceLink = ob.getString("resource-link") + AAIResourceUri siUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, new URI(resourceLink)) - String[] split = resourceLink.split("/aai/") - String siRelatedLink = "/aai/" + split[1] - - execution.setVariable("PSI_resourceLink", resourceLink) + execution.setVariable("PSI_resourceLink", siUri) }else{ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai") } @@ -277,27 +275,11 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ //AAI PUT AaiUtil aaiUriUtil = new AaiUtil(this) - String aaiEndpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - String siResourceLink= execution.getVariable("PSI_resourceLink") - - String siUri = "" - msoLogger.debug("PSI_resourceLink:" + siResourceLink) - - if(!isBlank(siResourceLink)) { - msoLogger.debug("Incoming PSI Resource Link is: " + siResourceLink) - String[] split = siResourceLink.split("/aai/") - siUri = "/aai/" + split[1] - } - else - { - msg = "Parent Service Link in AAI is null" - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - arUrl = "${aaiEndpoint}${siUri}" + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + AAIResourceUri siResourceLink= execution.getVariable("PSI_resourceLink") + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + arUrl = arUtils.createARUrl(execution, siResourceLink, allottedResourceId) execution.setVariable("aaiARPath", arUrl) - msoLogger.debug("GET AllottedResource AAI URL is:\n" + arUrl) + msoLogger.debug("PUT AllottedResource AAI URL is:\n" + arUrl) String namespace = aaiUriUtil.getNamespaceFromUri(execution, arUrl) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy index 5f9b4b8ecd..ef5660c081 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy @@ -20,23 +20,22 @@ package org.onap.so.bpmn.vcpe.scripts; +import static org.apache.commons.lang3.StringUtils.* + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.*; -import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.core.RollbackData -import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.rest.APIResponse - -import java.util.UUID; -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.springframework.web.util.UriUtils; -import static org.apache.commons.lang3.StringUtils.* - +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse /** * This groovy class supports the <class>DoCreateAllottedResourceTXC.bpmn</class> process. @@ -204,27 +203,11 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ //AAI PUT AaiUtil aaiUriUtil = new AaiUtil(this) - String aaiEndpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - String siResourceLink= execution.getVariable("PSI_resourceLink") - - String siUri = "" - msoLogger.debug("PSI_resourceLink:" + siResourceLink) - - if(!isBlank(siResourceLink)) { - msoLogger.debug("Incoming PSI Resource Link is: " + siResourceLink) - String[] split = siResourceLink.split("/aai/") - siUri = "/aai/" + split[1] - } - else - { - msg = "Parent Service Link in AAI is null" - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - arUrl = "${aaiEndpoint}${siUri}" + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + AAIResourceUri siResourceLink= execution.getVariable("PSI_resourceLink") + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + arUrl = arUtils.createARUrl(execution, siResourceLink, allottedResourceId) execution.setVariable("aaiARPath", arUrl) - msoLogger.debug("GET AllottedResource AAI URL is:\n" + arUrl) + msoLogger.debug("PUT AllottedResource AAI URL is:\n" + arUrl) String namespace = aaiUriUtil.getNamespaceFromUri(execution, arUrl) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java index a92fad2e5f..8bba435d0c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java @@ -25,7 +25,9 @@ import java.util.UUID; import org.onap.aai.domain.yang.Pnf; import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection; import org.onap.so.client.aai.AAIRestClientImpl; +import org.springframework.stereotype.Component; +@Component public class AaiConnectionImpl implements AaiConnection { @Override diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java index a10267e666..05109abc84 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java @@ -24,7 +24,9 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +@Component public class CancelDmaapSubscription implements JavaDelegate { private DmaapClient dmaapClient; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java index 12ddf8465e..b49c4211b1 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java @@ -20,12 +20,10 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_IP; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; import java.io.IOException; -import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.so.bpmn.common.scripts.ExceptionUtil; @@ -34,6 +32,7 @@ import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiResponse; import org.onap.so.bpmn.infrastructure.pnf.implementation.CheckAaiForCorrelationIdImplementation; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; /** * Implementation of "Check AAI for correlation_id" task in CreateAndActivatePnfResource.bpmn @@ -46,6 +45,7 @@ import org.springframework.beans.factory.annotation.Autowired; * - aaiContainsInfoAboutIp - local Boolean */ +@Component public class CheckAaiForCorrelationIdDelegate implements JavaDelegate { private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, CheckAaiForCorrelationIdDelegate.class); private CheckAaiForCorrelationIdImplementation implementation = new CheckAaiForCorrelationIdImplementation(); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java index ec1ef21028..a8754cd4a0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java @@ -27,6 +27,7 @@ import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.aai.domain.yang.Pnf; import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; /** * Implementation of "Create AAI entry with pnf-id = correlation_id" task in CreateAndActivatePnfResource.bpmn @@ -34,6 +35,7 @@ import org.springframework.beans.factory.annotation.Autowired; * Inputs: * - correlationId - String */ +@Component public class CreateAaiEntryWithPnfIdDelegate implements JavaDelegate { private AaiConnection aaiConnection; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java index 61b1ca4cae..1a75b0998c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java @@ -25,7 +25,9 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +@Component public class InformDmaapClient implements JavaDelegate { private DmaapClient dmaapClient; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java index d210e5e64f..164f51f579 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java @@ -27,13 +27,22 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.so.bpmn.common.scripts.ExceptionUtil; import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +@Component public class PnfCheckInputs implements JavaDelegate { private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, PnfCheckInputs.class); private String defaultTimeout; + @Autowired + public PnfCheckInputs(@Value("${aai.pnfEntryNotificationTimeout}") String defaultTimeout) { + this.defaultTimeout = defaultTimeout; + } + @Override public void execute(DelegateExecution execution) { String correlationId = (String) execution.getVariable(CORRELATION_ID); @@ -51,7 +60,4 @@ public class PnfCheckInputs implements JavaDelegate { } } - public void setDefaultTimeout(String defaultTimeout) { - this.defaultTimeout = defaultTimeout; - } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java index 90b48ab2c1..159298b4ad 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2018 Nokia. + * ================================================================================ * 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 @@ -31,41 +33,32 @@ import java.util.Spliterator; public final class JsonUtilForCorrelationId { - private static final String JSON_HEADER = "pnfRegistrationFields"; private static final String JSON_CORRELATION_ID_FIELD_NAME = "correlationId"; static List<String> parseJsonToGelAllCorrelationId(String json) { - List<String> list = new ArrayList<>(); JsonElement je = new JsonParser().parse(json); - if (je.isJsonObject()) { - getCorrelationIdFromJsonObject(je.getAsJsonObject()).ifPresent(corr -> list.add(corr)); - } else { - JsonArray array = je.getAsJsonArray(); - Spliterator<JsonElement> spliterator = array.spliterator(); - spliterator.forEachRemaining(jsonElement -> { - parseJsonElementToJsonObject(jsonElement) - .ifPresent(jsonObject -> getCorrelationIdFromJsonObject(jsonObject) - .ifPresent(correlationId -> list.add(correlationId))); - }); - } + JsonArray array = je.getAsJsonArray(); + List<String> list = new ArrayList<>(); + Spliterator<JsonElement> spliterator = array.spliterator(); + spliterator.forEachRemaining(jsonElement -> { + handleEscapedCharacters(jsonElement) + .ifPresent(jsonObject -> getCorrelationId(jsonObject) + .ifPresent(correlationId -> list.add(correlationId))); + }); return list; } - private static Optional<JsonObject> parseJsonElementToJsonObject(JsonElement jsonElement) { + private static Optional<JsonObject> handleEscapedCharacters(JsonElement jsonElement) { if (jsonElement.isJsonObject()) { return Optional.ofNullable(jsonElement.getAsJsonObject()); } return Optional.ofNullable(new JsonParser().parse(jsonElement.getAsString()).getAsJsonObject()); } - private static Optional<String> getCorrelationIdFromJsonObject(JsonObject jsonObject) { - if (jsonObject.has(JSON_HEADER)) { - JsonObject jo = jsonObject.getAsJsonObject(JSON_HEADER); - if (jo.has(JSON_CORRELATION_ID_FIELD_NAME)) { - return Optional.ofNullable(jo.get(JSON_CORRELATION_ID_FIELD_NAME).getAsString()); - } + private static Optional<String> getCorrelationId(JsonObject jsonObject) { + if (jsonObject.has(JSON_CORRELATION_ID_FIELD_NAME)) { + return Optional.ofNullable(jsonObject.get(JSON_CORRELATION_ID_FIELD_NAME).getAsString()); } return Optional.empty(); } - } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java index 70323b726c..373e84bb9d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2018 Nokia. + * ================================================================================ * 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 @@ -21,16 +23,13 @@ package org.onap.so.bpmn.infrastructure.pnf.dmaap; import java.io.IOException; -import java.net.URI; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; - import javax.ws.rs.core.UriBuilder; - import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; @@ -38,43 +37,35 @@ import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @Component -@Scope("prototype") public class PnfEventReadyDmaapClient implements DmaapClient { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, PnfEventReadyDmaapClient.class); + private static final MsoLogger LOGGER = MsoLogger + .getMsoLogger(MsoLogger.Catalog.RA, PnfEventReadyDmaapClient.class); - private final Environment env; private HttpClient httpClient; - private String dmaapHost; - private int dmaapPort; - private String dmaapProtocol; - private String dmaapUriPathPrefix; - private String dmaapTopicName; - private String consumerId; - private String consumerGroup; private Map<String, Runnable> pnfCorrelationIdToThreadMap; private HttpGet getRequest; - private int dmaapClientDelayInSeconds; + private int topicListenerDelayInSeconds; private volatile ScheduledThreadPoolExecutor executor; private volatile boolean dmaapThreadListenerIsRunning; @Autowired public PnfEventReadyDmaapClient(Environment env) { - this.env = env; - } - - public void init() { httpClient = HttpClientBuilder.create().build(); pnfCorrelationIdToThreadMap = new ConcurrentHashMap<>(); - dmaapHost = env.getProperty("pnf.dmaap.host"); - dmaapPort = env.getProperty("pnf.dmaap.port", Integer.class); + topicListenerDelayInSeconds = env.getProperty("pnf.dmaap.topicListenerDelayInSeconds", Integer.class); executor = null; - getRequest = new HttpGet(buildURI()); + getRequest = new HttpGet(UriBuilder.fromUri(env.getProperty("pnf.dmaap.uriPathPrefix")) + .scheme(env.getProperty("pnf.dmaap.protocol")) + .host(env.getProperty("pnf.dmaap.host")) + .port(env.getProperty("pnf.dmaap.port", Integer.class)) + .path(env.getProperty("pnf.dmaap.topicName")) + .path(env.getProperty("pnf.dmaap.consumerGroup")) + .path(env.getProperty("pnf.dmaap.consumerId")).build()); } @Override @@ -102,7 +93,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient { executor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); executor.scheduleWithFixedDelay(new DmaapTopicListenerThread(), 0, - dmaapClientDelayInSeconds, TimeUnit.SECONDS); + topicListenerDelayInSeconds, TimeUnit.SECONDS); dmaapThreadListenerIsRunning = true; } } @@ -115,38 +106,6 @@ public class PnfEventReadyDmaapClient implements DmaapClient { } } - private URI buildURI() { - return UriBuilder.fromUri(dmaapUriPathPrefix) - .scheme(dmaapProtocol) - .host(dmaapHost) - .port(dmaapPort).path(dmaapTopicName) - .path(consumerGroup).path(consumerId).build(); - } - - public void setDmaapProtocol(String dmaapProtocol) { - this.dmaapProtocol = dmaapProtocol; - } - - public void setDmaapUriPathPrefix(String dmaapUriPathPrefix) { - this.dmaapUriPathPrefix = dmaapUriPathPrefix; - } - - public void setDmaapTopicName(String dmaapTopicName) { - this.dmaapTopicName = dmaapTopicName; - } - - public void setConsumerId(String consumerId) { - this.consumerId = consumerId; - } - - public void setConsumerGroup(String consumerGroup) { - this.consumerGroup = consumerGroup; - } - - public void setDmaapClientDelayInSeconds(int dmaapClientDelayInSeconds) { - this.dmaapClientDelayInSeconds = dmaapClientDelayInSeconds; - } - class DmaapTopicListenerThread implements Runnable { @Override diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java index 60f109a81f..0d7c4abeee 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.properties; import java.util.Arrays; import java.util.List; +import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.logger.MsoLogger; @@ -37,7 +38,7 @@ public class BPMNProperties { } public static List<String> getResourceSequenceProp(String input) { - String resourceSequence = getProperty("mso.workflow.custom." + input + ".resource.sequence", null); + String resourceSequence = UrnPropertiesReader.getVariable("mso.workflow.custom."+ input + ".resource.sequence"); if (resourceSequence != null) { return Arrays.asList(resourceSequence.split(",")); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy index 0a1f8f2859..11dbf7d2ee 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy @@ -1126,10 +1126,10 @@ String queryIdAIIResponse_SRIOV = <relationship-list> <relationship> <related-to>tenant</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn16/tenants/tenant/6accefef3cb442ff9e644d589fb04107</related-link> + <related-link>https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn16/tenants/tenant/6accefef3cb442ff9e644d589fb04107</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -1146,10 +1146,10 @@ String queryIdAIIResponse_SRIOV = </relationship> <relationship> <related-to>cloud-region</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn16</related-link> + <related-link>https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn16</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -1238,7 +1238,7 @@ String queryIdAIIResponse_SRIOV = <relationship-list> <relationship> <related-to>cloud-region</related-to> - <related-link>https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/ + <related-link>https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/ </related-link> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -1246,7 +1246,7 @@ String queryIdAIIResponse_SRIOV = </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <related-to-property> <property-key>cloud-region.owner-defined-type</property-key> @@ -1255,7 +1255,7 @@ String queryIdAIIResponse_SRIOV = </relationship> <relationship> <related-to>tenant</related-to> - <related-link>https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/4ae1d3446a4c48b2bec44b6cfba06d68/</related-link> + <related-link>https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/tenants/tenant/4ae1d3446a4c48b2bec44b6cfba06d68/</related-link> <relationship-data> <relationship-key>tenant.tenant-id</relationship-key> <relationship-value>4ae1d3446a4c48b2bec44b6cfba06d68 @@ -1263,7 +1263,7 @@ String queryIdAIIResponse_SRIOV = </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -3623,9 +3623,9 @@ String sdncAdapterWorkflowAssignResponse = when(mockExecution.getVariable("prefix")).thenReturn(Prefix) when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedvIPRNetworkRequest) when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") // when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") @@ -3659,9 +3659,9 @@ String sdncAdapterWorkflowAssignResponse = when(mockExecution.getVariable("prefix")).thenReturn(Prefix) when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedvIPRNetworkRequest) when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") // when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") @@ -3695,9 +3695,9 @@ String sdncAdapterWorkflowAssignResponse = when(mockExecution.getVariable("prefix")).thenReturn(Prefix) when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(vnfRequestFakeRegion) when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - //old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + //old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") // when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy index 1a2d16d9d0..7f55eb3dcb 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy @@ -730,10 +730,10 @@ String aaiWorkflowException = </relationship> <relationship> <related-to>cloud-region</related-to> - <related-link>cloud-infrastructure/cloud-regions/cloud-region/att-aic/RDM2WAGPLCP/</related-link> + <related-link>cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RDM2WAGPLCP/</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -1697,9 +1697,9 @@ String sdncAdapterWorkflowFormattedResponse_404 = when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) when(mockExecution.getVariable(Prefix + "lcpCloudRegion")).thenReturn("RDM2WAGPLCP") when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") @@ -1727,9 +1727,9 @@ String sdncAdapterWorkflowFormattedResponse_404 = when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(vnfRequestCloudRegionNotFound) when(mockExecution.getVariable(Prefix + "lcpCloudRegion")).thenReturn("MDTWNJ21") when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") @@ -1759,9 +1759,9 @@ String sdncAdapterWorkflowFormattedResponse_404 = when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) when(mockExecution.getVariable(Prefix + "lcpCloudRegion")).thenReturn("RDM2WAGPLCP") when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") // when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy index de3db5b5a8..14dd10fc49 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy @@ -736,7 +736,7 @@ String expectedNetworkInputsMissingNetworkId = <relationship-list> <relationship> <related-to>cloud-region</related-to> - <related-link>https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/ + <related-link>https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/ </related-link> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -744,7 +744,7 @@ String expectedNetworkInputsMissingNetworkId = </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <related-to-property> <property-key>cloud-region.owner-defined-type</property-key> @@ -753,7 +753,7 @@ String expectedNetworkInputsMissingNetworkId = </relationship> <relationship> <related-to>tenant</related-to> - <related-link>https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/4ae1d3446a4c48b2bec44b6cfba06d68/</related-link> + <related-link>https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/tenants/tenant/4ae1d3446a4c48b2bec44b6cfba06d68/</related-link> <relationship-data> <relationship-key>tenant.tenant-id</relationship-key> <relationship-value>4ae1d3446a4c48b2bec44b6cfba06d68 @@ -761,7 +761,7 @@ String expectedNetworkInputsMissingNetworkId = </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -2148,7 +2148,7 @@ String rollbackNetworkRequest = when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") @@ -2181,7 +2181,7 @@ String rollbackNetworkRequest = when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") @@ -2214,7 +2214,7 @@ String rollbackNetworkRequest = when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(vnfRequestFakeRegion) when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy index 67b1c23ae1..6ed9dbd2bd 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy @@ -84,7 +84,7 @@ class DoUpdateVfModuleTest { ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable("prefix")).thenReturn(prefix) when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(prefix + "aicCloudRegion")).thenReturn("att-aic") + when(mockExecution.getVariable(prefix + "aicCloudRegion")).thenReturn("CloudOwner") when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region") when(mockExecution.getVariable("mso.workflow.default.aai.cloud-region.version")).thenReturn("8") when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") @@ -94,7 +94,7 @@ class DoUpdateVfModuleTest { DoUpdateVfModule obj = new DoUpdateVfModule() obj.prepConfirmVolumeGroupTenant(mockExecution) - Mockito.verify(mockExecution).setVariable(prefix + "queryCloudRegionRequest", "http://localhost:28090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + Mockito.verify(mockExecution).setVariable(prefix + "queryCloudRegionRequest", "http://localhost:28090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") Mockito.verify(mockExecution).setVariable(prefix + "queryCloudRegionReturnCode", "200") Mockito.verify(mockExecution).setVariable(prefix + "cloudRegionForVolume", "AAIAIC25") Mockito.verify(mockExecution).setVariable(prefix + "isCloudRegionGood", true) @@ -295,7 +295,7 @@ class DoUpdateVfModuleTest { } private static void mockData() { - stubFor(get(urlMatching(".*/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic")) + stubFor(get(urlMatching(".*/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner")) .willReturn(aResponse() .withStatus(200).withHeader("Content-Type", "text/xml") .withBodyFile("DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml"))) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy index 84da045450..d0ded39146 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy @@ -31,6 +31,7 @@ import org.junit.Test import org.junit.Ignore import org.mockito.MockitoAnnotations import org.camunda.bpm.engine.delegate.BpmnError +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.HomingSolution import org.onap.so.bpmn.mock.FileUtil @@ -195,7 +196,53 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.preProcessRequest(mex) })) } - + + @Test + @Ignore + public void preProcessRequest_vimId() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + UrnPropertiesReader + + def req = request + .replace('"mdt1"', '"CloudOwner_CloudRegion1"') + + when(mex.getVariable("bpmnRequest")).thenReturn(req) + when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn("PT5S") + when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S") + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.preProcessRequest(mex) + + verify(mex).setVariable("cloudRegionId", "CloudRegion1") + verify(mex).setVariable("cloudOwner", "CloudOwner") + } + + @Test + @Ignore + public void preProcessRequest_noVimId() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + + def req = request + .replace('"mdt1"', '"CloudRegion1_"') + + when(mex.getVariable("bpmnRequest")).thenReturn(req) + when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn(60) + when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn("PT5S") + when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S") + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.preProcessRequest(mex) + + verify(mex).setVariable("cloudRegionId", "CloudRegion1_") + verify(mex).setVariable("cloudOwner", "my-cloud-owner") + + } + + @Test // @Ignore public void preProcessRequest_BpmnError() { @@ -579,6 +626,45 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { verify(mex).setVariable("cloudOwner", "my-cloud-owner") verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba") } + + @Test + public void prepareVnfAndModulesCreate_noVimId() { + ExecutionEntity mex = setupMock() + initPrepareVnfAndModulesCreate(mex) + + def req = request + .replace('"mdt1"', '"CloudRegion1_"') + + when(mex.getVariable("createVcpeServiceRequest")).thenReturn(req) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.prepareVnfAndModulesCreate(mex) + + verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") + verify(mex).setVariable("cloudRegionId", "CloudRegion1_") + verify(mex).setVariable("lcpCloudRegionId", "CloudRegion1_") + verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba") + } + + @Test + public void prepareVnfAndModulesCreate_vimId() { + ExecutionEntity mex = setupMock() + initPrepareVnfAndModulesCreate(mex) + + def req = request + .replace('"mdt1"', '"CloudOwner_CloudRegion1"') + + when(mex.getVariable("createVcpeServiceRequest")).thenReturn(req) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + CreateVcpeResCustService.prepareVnfAndModulesCreate(mex) + + verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") + verify(mex).setVariable("cloudOwner", "CloudOwner") + verify(mex).setVariable("cloudRegionId", "CloudRegion1") + verify(mex).setVariable("lcpCloudRegionId", "CloudRegion1") + verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba") + } @Test // @Ignore diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java index aab289fd90..2e8fb4be78 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java @@ -30,55 +30,52 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.junit.Before; import org.junit.Test; public class PnfCheckInputsTest { - private PnfCheckInputs delegate; - - @Before - public void setUp() throws Exception { - delegate = new PnfCheckInputs(); - } + private static final String DEFAULT_TIMEOUT = "P1D"; private DelegateExecution mockDelegateExecution() { + new PnfCheckInputs(DEFAULT_TIMEOUT); DelegateExecution delegateExecution = mock(DelegateExecution.class); when(delegateExecution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue"); return delegateExecution; } @Test - public void shouldThrowException_whenPnfIdNotSet() throws Exception { + public void shouldThrowException_whenPnfIdNotSet() { // given + PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT); DelegateExecution delegateExecution = mockDelegateExecution(); // when, then - assertThatThrownBy(() -> delegate.execute(delegateExecution)).isInstanceOf(BpmnError.class); + assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); } private DelegateExecution mockDelegateExecutionWithCorrelationId() { + new PnfCheckInputs(DEFAULT_TIMEOUT); DelegateExecution delegateExecution = mockDelegateExecution(); when(delegateExecution.getVariable(CORRELATION_ID)).thenReturn("testCorrelationId"); return delegateExecution; } @Test - public void shouldThrowException_whenTimeoutIsNotSetAndDefaultIsNotDefined() throws Exception { + public void shouldThrowException_whenTimeoutIsNotSetAndDefaultIsNotDefined() { // given + PnfCheckInputs testedObject = new PnfCheckInputs(null); DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId(); // when, then - assertThatThrownBy(() -> delegate.execute(delegateExecution)).isInstanceOf(BpmnError.class); + assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); } @Test - public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() throws Exception { + public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() { // given - String defaultTimeout = "T1D"; - delegate.setDefaultTimeout(defaultTimeout); + PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT); DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId(); // when - delegate.execute(delegateExecution); + testedObject.execute(delegateExecution); // then - verify(delegateExecution).setVariable(eq(TIMEOUT_FOR_NOTIFICATION), eq(defaultTimeout)); + verify(delegateExecution).setVariable(eq(TIMEOUT_FOR_NOTIFICATION), eq(DEFAULT_TIMEOUT)); } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java index 24d1810ac6..fde112b009 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2018 Nokia. + * ================================================================================ * 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 @@ -24,30 +26,18 @@ import static org.assertj.core.api.Assertions.assertThat; import java.util.List; import org.junit.Test; -import org.onap.so.bpmn.infrastructure.pnf.dmaap.JsonUtilForCorrelationId; public class JsonUtilForCorrelationIdTest { - private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[\n" - + " {\n" - + " \"pnfRegistrationFields\" : {\n" - + " \"correlationId\" : \"corrTest1\",\n" - + " \"value\" : \"value1\"\n" - + " }\n" - + " },\n" - + " {\n" - + " \"pnfRegistrationFields\" : {\n" - + " \"correlationId\" : \"corrTest2\",\n" - + " \"value\" : \"value2\"\n" - + " }\n" - + " }\n" - + "]"; + private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[{\"correlationId\": \"corrTest1\"," + + "\"key1\":\"value1\"},{\"correlationId\": \"corrTest2\",\"key2\":\"value2\"}]"; + + private static final String JSON_WITH_ONE_CORRELATION_ID = "[{\"correlationId\":\"corrTest3\"}]"; + + private static final String JSON_WITH_TWO_CORRELATION_ID_AND_ESCAPED_CHARACTERS = + "[\"{\\\"correlationId\\\":\\\"corrTest4\\\"}\", \"{\\\"correlationId\\\":\\\"corrTest5\\\"}\"]"; - private static final String JSON_EXAMPLE_WITH_CORRELATION_ID2 = "{\"pnfRegistrationFields\":{\"correlationId\":\"corrTest3\"}}"; - private static final String JSON_EXAMPLE_WITH_CORRELATION_ID3 = "[\"{\\\"pnfRegistrationFields\\\":" - + "{\\\"correlationId\\\":\\\"corrTest4\\\"}}\", \"{\\\"pnfRegistrationFields\\\":" - + "{\\\"correlationId\\\":\\\"corrTest5\\\"}}\"]"; - private static final String JSON_EXAMPLE_WITH_CORRELATION_ID4 = "{\"header\":{\"key\":\"value\"}}"; + private static final String JSON_WITH_NO_CORRELATION_ID = "[{\"key1\":\"value1\"}]"; @Test public void parseJsonSuccessful() { @@ -56,21 +46,21 @@ public class JsonUtilForCorrelationIdTest { assertThat(expectedResult).containsExactly("corrTest1", "corrTest2"); List<String> expectedResult2 = JsonUtilForCorrelationId - .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID2); + .parseJsonToGelAllCorrelationId(JSON_WITH_ONE_CORRELATION_ID); assertThat(expectedResult2).containsExactly("corrTest3"); } @Test public void parseJsonWithEscapeCharacters_Successful() { List<String> expectedResult = JsonUtilForCorrelationId - .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID3); + .parseJsonToGelAllCorrelationId(JSON_WITH_TWO_CORRELATION_ID_AND_ESCAPED_CHARACTERS); assertThat(expectedResult).containsExactly("corrTest4", "corrTest5"); } @Test public void parseJson_emptyListReturnedWhenNothingFound() { List<String> expectedResult = JsonUtilForCorrelationId - .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID4); + .parseJsonToGelAllCorrelationId(JSON_WITH_NO_CORRELATION_ID); assertThat(expectedResult).isEmpty(); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java index 9ae7ad9bdc..1b0169d6d3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2018 Nokia. + * ================================================================================ * 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 @@ -33,7 +35,6 @@ import java.io.UnsupportedEncodingException; import java.lang.reflect.Field; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledThreadPoolExecutor; import org.apache.http.HttpEntity; @@ -47,7 +48,6 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.onap.so.bpmn.infrastructure.pnf.dmaap.PnfEventReadyDmaapClient.DmaapTopicListenerThread; @@ -57,22 +57,10 @@ public class PnfEventReadyDmaapClientTest { private static final String CORRELATION_ID = "corrTestId"; private static final String CORRELATION_ID_NOT_FOUND_IN_MAP = "otherCorrId"; - private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[\n" - + " {\n" - + " \"pnfRegistrationFields\" : {\n" - + " \"correlationId\" : \"%s\",\n" - + " \"value\" : \"value1\"\n" - + " }\n" - + " },\n" - + " {\n" - + " \"pnfRegistrationFields\" : {\n" - + " \"correlationId\" : \"corr\",\n" - + " \"value\" : \"value2\"\n" - + " }\n" - + " }\n" - + "]"; - private static final String JSON_EXAMPLE_WITH_NO_CORRELATION_ID = - "{\"pnfRegistrationFields\":{\"field\":\"value\"}}"; + private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[{\"correlationId\": \"%s\"," + + "\"value\":\"value1\"},{\"correlationId\": \"corr\",\"value\":\"value2\"}]"; + + private static final String JSON_EXAMPLE_WITH_NO_CORRELATION_ID = "[{\"key1\":\"value1\"}]"; private static final String HOST = "hostTest"; private static final int PORT = 1234; @@ -81,6 +69,8 @@ public class PnfEventReadyDmaapClientTest { private static final String EVENT_TOPIC_TEST = "eventTopicTest"; private static final String CONSUMER_ID = "consumerTestId"; private static final String CONSUMER_GROUP = "consumerGroupTest"; + private static final int TOPIC_LISTENER_DELAY_IN_SECONDS = 5; + @Mock private Environment env; private PnfEventReadyDmaapClient testedObject; @@ -92,16 +82,16 @@ public class PnfEventReadyDmaapClientTest { @Before public void init() throws NoSuchFieldException, IllegalAccessException { - testedObject = new PnfEventReadyDmaapClient(env); when(env.getProperty(eq("pnf.dmaap.port"), eq(Integer.class))).thenReturn(PORT); when(env.getProperty(eq("pnf.dmaap.host"))).thenReturn(HOST); - testedObject.setDmaapProtocol(PROTOCOL); - testedObject.setDmaapUriPathPrefix(URI_PATH_PREFIX); - testedObject.setDmaapTopicName(EVENT_TOPIC_TEST); - testedObject.setConsumerId(CONSUMER_ID); - testedObject.setConsumerGroup(CONSUMER_GROUP); - testedObject.setDmaapClientDelayInSeconds(1); - testedObject.init(); + when(env.getProperty(eq("pnf.dmaap.protocol"))).thenReturn(PROTOCOL); + when(env.getProperty(eq("pnf.dmaap.uriPathPrefix"))).thenReturn(URI_PATH_PREFIX); + when(env.getProperty(eq("pnf.dmaap.topicName"))).thenReturn(EVENT_TOPIC_TEST); + when(env.getProperty(eq("pnf.dmaap.consumerId"))).thenReturn(CONSUMER_ID); + when(env.getProperty(eq("pnf.dmaap.consumerGroup"))).thenReturn(CONSUMER_GROUP); + when(env.getProperty(eq("pnf.dmaap.topicListenerDelayInSeconds"), eq(Integer.class))) + .thenReturn(TOPIC_LISTENER_DELAY_IN_SECONDS); + testedObject = new PnfEventReadyDmaapClient(env); testedObjectInnerClassThread = testedObject.new DmaapTopicListenerThread(); httpClientMock = mock(HttpClient.class); threadMockToNotifyCamundaFlow = mock(Runnable.class); diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json index a4190a76ee..b234df5364 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_defaultCloudRegionByCloudRegionId.json @@ -1,5 +1,5 @@ { - "cloud-owner": "att-aic", + "cloud-owner": "CloudOwner", "cloud-region-id": "mdt1", "cloud-type": "openstack", "owner-defined-type": "lcp", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json index f0936d6648..0ad0f054b0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_genericVnfsByVnfId.json @@ -72,11 +72,11 @@ { "related-to": "vserver", "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -99,11 +99,11 @@ { "related-to": "vserver", "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/14551849-1e70-45cd-bc5d-a256d49548a2", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/14551849-1e70-45cd-bc5d-a256d49548a2", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -126,11 +126,11 @@ { "related-to": "vserver", "relationship-label": "tosca.relationships.HostedOn", - "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/48bd7f11-408f-417c-b834-b41c1b98f7d7", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/48bd7f11-408f-417c-b834-b41c1b98f7d7", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_pserverByVnfId.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_pserverByVnfId.json index 4b1f69aacf..892e41a429 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_pserverByVnfId.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/AAI/AAI_pserverByVnfId.json @@ -17,11 +17,11 @@ "relationship": [ { "relatedTo": "vserver", - "relatedLink": "/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/8862-tenantl-LB1113/vservers/vserver/8862-Lvserver-LB1113", + "relatedLink": "/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/tenants/tenant/8862-tenantl-LB1113/vservers/vserver/8862-Lvserver-LB1113", "relationshipData": [ { "relationshipKey": "cloud-region.cloud-owner", - "relationshipValue": "att-aic" + "relationshipValue": "CloudOwner" }, { "relationshipKey": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json index d5d234cbf6..e052360c6c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json @@ -107,11 +107,11 @@ }, { "related-to": "cloud-region", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -127,11 +127,11 @@ }, { "related-to": "tenant", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json index aa6320801e..84ce037a2d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json @@ -102,11 +102,11 @@ }, { "related-to": "cloud-region", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -122,11 +122,11 @@ }, { "related-to": "tenant", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json index 5addff2d70..0185d56d06 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json @@ -1,5 +1,5 @@ { - "cloud-owner": "att-aic", + "cloud-owner": "CloudOwner", "cloud-region-id": "mtn6", "cloud-type": "openstack", "owner-defined-type": "LCP", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json index fadbf9c244..d850e51593 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json @@ -1,5 +1,5 @@ { - "cloud-owner": "att-aic", + "cloud-owner": "CloudOwner", "cloud-region-id": "mtn6", "cloud-type": "openstack", "owner-defined-type": "LCP", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json index 97611c1d62..ab98fa4b70 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json @@ -1,5 +1,5 @@ { - "cloud-owner": "att-aic", + "cloud-owner": "CloudOwner", "cloud-region-id": "ERROR", "cloud-type": "openstack", "owner-defined-type": "LCP", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json index 181494dff2..5432133631 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json @@ -73,11 +73,11 @@ { "related-to": "cloud-region", "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/DYH1A", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -94,11 +94,11 @@ { "related-to": "tenant", "relationship-label": "org.onap.relationships.inventory.Uses", - "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A/tenants/tenant/2871503957144f72b3cf481b379828ec", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/DYH1A/tenants/tenant/2871503957144f72b3cf481b379828ec", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json index b22f389c40..81f9a78e86 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json @@ -73,11 +73,11 @@ }, { "related-to": "cloud-region", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", @@ -91,11 +91,11 @@ }, { "related-to": "tenant", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml index 6dd91c64c9..5e1e2f62a3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml @@ -68,10 +68,10 @@ </relationship> <relationship> <related-to>cloud-region</related-to> - <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6</related-link> + <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -84,10 +84,10 @@ </relationship> <relationship> <related-to>tenant</related-to> - <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8</related-link> + <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json index f076c9044c..a99d25bdc9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json @@ -73,11 +73,11 @@ }, { "related-to": "cloud-region", - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6", "relationship-data": [ { "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "att-aic" + "relationship-value": "CloudOwner" }, { "relationship-key": "cloud-region.cloud-region-id", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml index 92fec2dc64..8b70a139e6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml @@ -71,10 +71,10 @@ </relationship> <relationship> <related-to>cloud-region</related-to> - <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6</related-link> + <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -87,10 +87,10 @@ </relationship> <relationship> <related-to>tenant</related-to> - <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8</related-link> + <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml index 90c668c576..00fee73042 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>2.5</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml index 9b651f25e3..ca29b22424 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>3.0</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml index be820b83b1..eb2ed36edc 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml @@ -35,14 +35,14 @@ <relationship-list> <relationship> <related-to>tenant</related-to> - <related-link>https://aai-conexus-e2e.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/396d61752cf04c3b8ca2afcb4ee049e9/</related-link> + <related-link>https://aai-conexus-e2e.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/tenants/tenant/396d61752cf04c3b8ca2afcb4ee049e9/</related-link> <relationship-data> <relationship-key>tenant.tenant-id</relationship-key> <relationship-value>396d61752cf04c3b8ca2afcb4ee049e9</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml index 96e906f9bf..b653da6e0e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml @@ -9,14 +9,14 @@ <relationship-list> <relationship> <related-to>tenant</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/e444c311b27a45dc9522f2370d70f90f/</related-link> + <related-link>https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/tenants/tenant/e444c311b27a45dc9522f2370d70f90f/</related-link> <relationship-data> <relationship-key>tenant.tenant-id</relationship-key> <relationship-value>e444c311b27a45dc9522f2370d70f90f</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml index 7e2a676283..f4a9f3e9ba 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/CreateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml @@ -20,14 +20,14 @@ </relationship> <relationship> <related-to>tenant</related-to> - <related-link>https://localhost:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> + <related-link>https://localhost:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> <relationship-data> <relationship-key>tenant.tenant-id</relationship-key> <relationship-value>fba1bd1e195a404cacb9ce17a9b2b421</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -40,14 +40,14 @@ </relationship> <relationship> <related-to>vf-module</related-to> - <related-link>https://localhost:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> + <related-link>https://localhost:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> <relationship-data> <relationship-key>vf-module.vf-module-id</relationship-key> <relationship-value>fba1bd1e195a404cacb9ce17a9b2b421</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml index 90c668c576..00fee73042 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>2.5</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml index 9b651f25e3..ca29b22424 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>3.0</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml index c12bcd49c9..a34574fd83 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml @@ -45,10 +45,10 @@ </relationship> <relationship> <related-to>cloud-region</related-to> - <related-link>cloud-infrastructure/cloud-regions/cloud-region/att-aic/RDM2WAGPLCP/</related-link> + <related-link>cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RDM2WAGPLCP/</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml index fd10548cef..b0203db2d0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml @@ -20,14 +20,14 @@ </relationship> <relationship> <related-to>tenant</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> + <related-link>https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> <relationship-data> <relationship-key>tenant.tenant-id</relationship-key> <relationship-value>fba1bd1e195a404cacb9ce17a9b2b421</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/cloudRegion_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/cloudRegion_AAIResponse_Success.xml index 90c668c576..00fee73042 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/cloudRegion_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/cloudRegion_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>2.5</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/sdncGetResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/sdncGetResponse.xml index 20b5462729..d8c52084e0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/sdncGetResponse.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/sdncGetResponse.xml @@ -110,7 +110,7 @@ <generic-vnf-service> <cloud-region-id>FRN1</cloud-region-id> <outer-vlan-tag>4027</outer-vlan-tag> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <service-ecomp-model-information> <model-uuid>b73c6911-be64-448a-bb4b-7b7a7006507a</model-uuid> <model-version>5.0</model-version> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml index 90c668c576..00fee73042 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>2.5</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml index 90c668c576..00fee73042 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/cloudRegion_AAIResponse_Success.xml @@ -11,7 +11,7 @@ </rest:headers> <rest:payload contentType="text/xml"> <l3-network xmlns="http://org.openecomp.aai.inventory/v8"> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <cloud-region-id>RDM2WAGPLCP</cloud-region-id> <cloud-region-version>2.5</cloud-region-version> <complex-name>RDM2WAGPLCP</complex-name> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncGetResponse.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncGetResponse.xml index 20b5462729..d8c52084e0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncGetResponse.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoUpdateVfModule/sdncGetResponse.xml @@ -110,7 +110,7 @@ <generic-vnf-service> <cloud-region-id>FRN1</cloud-region-id> <outer-vlan-tag>4027</outer-vlan-tag> - <cloud-owner>att-aic</cloud-owner> + <cloud-owner>CloudOwner</cloud-owner> <service-ecomp-model-information> <model-uuid>b73c6911-be64-448a-bb4b-7b7a7006507a</model-uuid> <model-version>5.0</model-version> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml index 03d63f9f05..e36fbe1e04 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml @@ -9,14 +9,14 @@ <relationship-list> <relationship> <related-to>tenant</related-to> - <related-link>/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> + <related-link>/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/</related-link> <relationship-data> <relationship-key>tenant.tenant-id</relationship-key> <relationship-value>fba1bd1e195a404cacb9ce17a9b2b421</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml index 4087ab8f5f..f89b24b615 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml @@ -10,10 +10,10 @@ <relationship-list> <relationship> <related-to>volume-group</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/volume-groups/volume-group/064bd1c6-e377-4009-a744-e958eec6e727/</related-link> + <related-link>https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn6/volume-groups/volume-group/064bd1c6-e377-4009-a744-e958eec6e727/</related-link> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-supercool.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-supercool.xml index 49513f1eac..8186a6d075 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-supercool.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VfModule-supercool.xml @@ -12,7 +12,7 @@ <related-to>volume-group</related-to> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VolumeGroup.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VolumeGroup.xml index df84706ec5..59ef3e267b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VolumeGroup.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VfModularity/VolumeGroup.xml @@ -10,7 +10,7 @@ <related-to>tenant</related-to> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>CloudOwner</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> |