aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYulian Han <elaine.hanyulian@huawei.com>2018-11-13 20:40:26 +0800
committerYulian Han <elaine.hanyulian@huawei.com>2018-11-14 09:09:38 +0000
commit76ab7b1e386d56504f9ae5bce8f37d6272340612 (patch)
tree3c4e9c1d5ab1b2c6f3096817455c39fb35df260a
parent3d23673419de4ba18e5f8d365a98d7537e07956d (diff)
Get Csar file bug fix
modify getting openecomp.db.endpoint config codes Delete bug fix for R3 config changes Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa5f064408 Issue-ID: SO-1194 Signed-off-by: Yulian Han <elaine.hanyulian@huawei.com>
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy222
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy183
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy39
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy127
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy287
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy88
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy129
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy55
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy131
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy24
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy174
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy42
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy10
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn71
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn71
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn182
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectType.java4
27 files changed, 914 insertions, 968 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..30e6c452e0 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
@@ -31,6 +31,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
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
/**
@@ -162,7 +163,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)
}
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/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
index 47b3cc351f..f8c2ced2c7 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,20 @@ 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.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.*
@@ -50,7 +56,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
JsonUtils jsonUtil = new JsonUtils()
public void preProcessRequest(DelegateExecution execution){
-
+
msoLogger.info(" ***** Started preProcessRequest *****")
try {
@@ -208,27 +214,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:
@@ -388,7 +387,7 @@ 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>
@@ -450,7 +449,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)
}
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..ed8b3b4e0a 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
@@ -29,6 +29,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
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
/**
@@ -367,13 +368,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("&", "&amp;")
- 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("&", "&amp;")
- 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/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
index 3519bd7484..b5c9f8cda6 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
@@ -29,6 +29,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
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.*
@@ -361,7 +362,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)
}
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/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("&", "&amp;")
+ 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-flows/src/main/resources/process/CreateDeviceResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn
index 3c7be0937f..5fd2c69608 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn
@@ -33,7 +33,7 @@ csi.sendSyncResponse(execution)]]></bpmn:script>
<bpmn:outgoing>SequenceFlow_1rwaeun</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1caax8u" name="GoTo StartCreateDevinSDNC">
- <bpmn:incoming>SequenceFlow_1ylvnxq</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1ss02ik</bpmn:incoming>
<bpmn:linkEventDefinition name="StartCreateDevinSDNC" />
</bpmn:intermediateThrowEvent>
<bpmn:scriptTask id="ScriptTask_00y93jj" name="Check DevType" scriptFormat="groovy">
@@ -53,7 +53,7 @@ dcsi.checkDevType(execution)]]></bpmn:script>
<bpmn:incoming>SequenceFlow_0h4378g</bpmn:incoming>
<bpmn:linkEventDefinition name="StartCreateDevinSDNC" />
</bpmn:intermediateThrowEvent>
- <bpmn:sequenceFlow id="SequenceFlow_1ss02ik" name="VNF" sourceRef="ExclusiveGateway_0kba700" targetRef="ScriptTask_02rli65">
+ <bpmn:sequenceFlow id="SequenceFlow_1ss02ik" name="VNF" sourceRef="ExclusiveGateway_0kba700" targetRef="IntermediateThrowEvent_1caax8u">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("device_class" ) == "VNF" )}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_1hp2h5t" sourceRef="ScriptTask_00y93jj" targetRef="ExclusiveGateway_0kba700" />
@@ -74,39 +74,6 @@ dcsi.preProcessRequest(execution)]]></bpmn:script>
<bpmn:linkEventDefinition name="StartCreateDevinSDNC" />
</bpmn:intermediateCatchEvent>
<bpmn:sequenceFlow id="SequenceFlow_1gu13by" sourceRef="IntermediateCatchEvent_0slgrxw" targetRef="Task_0bga3e8" />
- <bpmn:callActivity id="CallActivity_0pyrfca" name="call CreateVNF" calledElement="DoCreateVNF">
- <bpmn:extensionElements>
- <camunda:in source="mso-request-id" target="mso-request-id" />
- <camunda:in source="requestAction" target="requestAction" />
- <camunda:in source="recipeParams" target="recipeParams" />
- <camunda:in source="resourceInput" target="resourceInput" />
- <camunda:in source="recipeParamXsd" target="recipeParamXsd" />
- <camunda:in source="operationId" target="operationId" />
- <camunda:in source="svcAction" target="svcAction" />
- <camunda:in source="requestAction" target="requestAction" />
- <camunda:in source="URN_mso_workflow_sdncadapter_callback" target="URN_mso_workflow_sdncadapter_callback" />
- <camunda:in source="networkRequest" target="networkRequest" />
- </bpmn:extensionElements>
- <bpmn:incoming>SequenceFlow_0pg3072</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0pkp4ce</bpmn:outgoing>
- </bpmn:callActivity>
- <bpmn:sequenceFlow id="SequenceFlow_0pkp4ce" sourceRef="CallActivity_0pyrfca" targetRef="ScriptTask_0u1piih" />
- <bpmn:scriptTask id="ScriptTask_02rli65" name="Get VNF Template fom SDC" scriptFormat="groovy">
- <bpmn:incoming>SequenceFlow_1ss02ik</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0pg3072</bpmn:outgoing>
- <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
-def dcsi = new CreateDeviceResource()
-dcsi.getVNFTemplatefromSDC(execution)]]></bpmn:script>
- </bpmn:scriptTask>
- <bpmn:sequenceFlow id="SequenceFlow_0pg3072" sourceRef="ScriptTask_02rli65" targetRef="CallActivity_0pyrfca" />
- <bpmn:scriptTask id="ScriptTask_0u1piih" name="Post VNF info process " scriptFormat="groovy">
- <bpmn:incoming>SequenceFlow_0pkp4ce</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1ylvnxq</bpmn:outgoing>
- <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
-def dcsi = new CreateDeviceResource()
-dcsi.postVNFInfoProcess(execution)]]></bpmn:script>
- </bpmn:scriptTask>
- <bpmn:sequenceFlow id="SequenceFlow_1ylvnxq" sourceRef="ScriptTask_0u1piih" targetRef="IntermediateThrowEvent_1caax8u" />
<bpmn:scriptTask id="ScriptTask_0p4b5vu" name="Prepare Create resource progress" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_0b5nrig</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_09s5dfc</bpmn:outgoing>
@@ -203,9 +170,9 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1ss02ik_di" bpmnElement="SequenceFlow_1ss02ik">
<di:waypoint xsi:type="dc:Point" x="384" y="-127" />
- <di:waypoint xsi:type="dc:Point" x="480" y="-127" />
+ <di:waypoint xsi:type="dc:Point" x="1026" y="-127" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="420.94444444444446" y="-148" width="23" height="12" />
+ <dc:Bounds x="696.8437500000002" y="-148" width="23" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1hp2h5t_di" bpmnElement="SequenceFlow_1hp2h5t">
@@ -252,36 +219,6 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script>
<dc:Bounds x="-75.5" y="108" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="CallActivity_0pyrfca_di" bpmnElement="CallActivity_0pyrfca">
- <dc:Bounds x="662" y="-167" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0pkp4ce_di" bpmnElement="SequenceFlow_0pkp4ce">
- <di:waypoint xsi:type="dc:Point" x="762" y="-127" />
- <di:waypoint xsi:type="dc:Point" x="849" y="-127" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="760.5" y="-148" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_02rli65_di" bpmnElement="ScriptTask_02rli65">
- <dc:Bounds x="480" y="-167" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0pg3072_di" bpmnElement="SequenceFlow_0pg3072">
- <di:waypoint xsi:type="dc:Point" x="580" y="-127" />
- <di:waypoint xsi:type="dc:Point" x="662" y="-127" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="621" y="-148" width="0" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_0u1piih_di" bpmnElement="ScriptTask_0u1piih">
- <dc:Bounds x="849" y="-167" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1ylvnxq_di" bpmnElement="SequenceFlow_1ylvnxq">
- <di:waypoint xsi:type="dc:Point" x="949" y="-127" />
- <di:waypoint xsi:type="dc:Point" x="1026" y="-127" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="987.5" y="-148" width="0" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_0p4b5vu_di" bpmnElement="ScriptTask_0p4b5vu">
<dc:Bounds x="309" y="-290" width="100" height="80" />
</bpmndi:BPMNShape>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn
index f0baac0254..73d38b383c 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn
@@ -33,7 +33,7 @@ csi.sendSyncResponse(execution)]]></bpmn:script>
<bpmn:outgoing>SequenceFlow_1rwaeun</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1caax8u" name="GoTo StartDeleteDevinSDNC">
- <bpmn:incoming>SequenceFlow_1ylvnxq</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1ss02ik</bpmn:incoming>
<bpmn:linkEventDefinition name="StartDeleteDevinSDNC" />
</bpmn:intermediateThrowEvent>
<bpmn:scriptTask id="ScriptTask_00y93jj" name="Check DevType from AAI" scriptFormat="groovy">
@@ -53,7 +53,7 @@ dcsi.checkDevType(execution)]]></bpmn:script>
<bpmn:incoming>SequenceFlow_0h4378g</bpmn:incoming>
<bpmn:linkEventDefinition name="StartDeleteDevinSDNC" />
</bpmn:intermediateThrowEvent>
- <bpmn:sequenceFlow id="SequenceFlow_1ss02ik" name="VNF" sourceRef="ExclusiveGateway_0kba700" targetRef="ScriptTask_02rli65">
+ <bpmn:sequenceFlow id="SequenceFlow_1ss02ik" name="VNF" sourceRef="ExclusiveGateway_0kba700" targetRef="IntermediateThrowEvent_1caax8u">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("device_class" ) == "VNF" )}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_1hp2h5t" sourceRef="ScriptTask_00y93jj" targetRef="ExclusiveGateway_0kba700" />
@@ -74,39 +74,6 @@ dcsi.preProcessRequest(execution)]]></bpmn:script>
<bpmn:linkEventDefinition name="StartDeleteDevinSDNC" />
</bpmn:intermediateCatchEvent>
<bpmn:sequenceFlow id="SequenceFlow_1gu13by" sourceRef="IntermediateCatchEvent_0slgrxw" targetRef="Task_0bga3e8" />
- <bpmn:callActivity id="CallActivity_0pyrfca" name="call DeleteVNF" calledElement="DoDeleteVNF">
- <bpmn:extensionElements>
- <camunda:in source="mso-request-id" target="mso-request-id" />
- <camunda:in source="requestAction" target="requestAction" />
- <camunda:in source="recipeParams" target="recipeParams" />
- <camunda:in source="resourceInput" target="resourceInput" />
- <camunda:in source="recipeParamXsd" target="recipeParamXsd" />
- <camunda:in source="operationId" target="operationId" />
- <camunda:in source="svcAction" target="svcAction" />
- <camunda:in source="requestAction" target="requestAction" />
- <camunda:in source="URN_mso_workflow_sdncadapter_callback" target="URN_mso_workflow_sdncadapter_callback" />
- <camunda:in source="networkRequest" target="networkRequest" />
- </bpmn:extensionElements>
- <bpmn:incoming>SequenceFlow_0pg3072</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0pkp4ce</bpmn:outgoing>
- </bpmn:callActivity>
- <bpmn:sequenceFlow id="SequenceFlow_0pkp4ce" sourceRef="CallActivity_0pyrfca" targetRef="ScriptTask_0u1piih" />
- <bpmn:scriptTask id="ScriptTask_02rli65" name="Get VNF ID" scriptFormat="groovy">
- <bpmn:incoming>SequenceFlow_1ss02ik</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0pg3072</bpmn:outgoing>
- <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
-def dcsi = new DeleteDeviceResource()
-dcsi.getVNFTemplatefromSDC(execution)]]></bpmn:script>
- </bpmn:scriptTask>
- <bpmn:sequenceFlow id="SequenceFlow_0pg3072" sourceRef="ScriptTask_02rli65" targetRef="CallActivity_0pyrfca" />
- <bpmn:scriptTask id="ScriptTask_0u1piih" name="Post VNF info process " scriptFormat="groovy">
- <bpmn:incoming>SequenceFlow_0pkp4ce</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1ylvnxq</bpmn:outgoing>
- <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
-def dcsi = new DeleteDeviceResource()
-dcsi.postVNFInfoProcess(execution)]]></bpmn:script>
- </bpmn:scriptTask>
- <bpmn:sequenceFlow id="SequenceFlow_1ylvnxq" sourceRef="ScriptTask_0u1piih" targetRef="IntermediateThrowEvent_1caax8u" />
<bpmn:scriptTask id="ScriptTask_14oc86m" name="Prepare Create resource progress" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_1g6azih</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_003svcq</bpmn:outgoing>
@@ -203,9 +170,9 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1ss02ik_di" bpmnElement="SequenceFlow_1ss02ik">
<di:waypoint xsi:type="dc:Point" x="384" y="-127" />
- <di:waypoint xsi:type="dc:Point" x="480" y="-127" />
+ <di:waypoint xsi:type="dc:Point" x="1026" y="-127" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="420.94444444444446" y="-148" width="23" height="12" />
+ <dc:Bounds x="696.8437500000002" y="-148" width="23" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1hp2h5t_di" bpmnElement="SequenceFlow_1hp2h5t">
@@ -252,36 +219,6 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script>
<dc:Bounds x="-75.5" y="108" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="CallActivity_0pyrfca_di" bpmnElement="CallActivity_0pyrfca">
- <dc:Bounds x="662" y="-167" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0pkp4ce_di" bpmnElement="SequenceFlow_0pkp4ce">
- <di:waypoint xsi:type="dc:Point" x="762" y="-127" />
- <di:waypoint xsi:type="dc:Point" x="849" y="-127" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="760.5" y="-148" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_02rli65_di" bpmnElement="ScriptTask_02rli65">
- <dc:Bounds x="480" y="-167" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0pg3072_di" bpmnElement="SequenceFlow_0pg3072">
- <di:waypoint xsi:type="dc:Point" x="580" y="-127" />
- <di:waypoint xsi:type="dc:Point" x="662" y="-127" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="621" y="-148" width="0" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_0u1piih_di" bpmnElement="ScriptTask_0u1piih">
- <dc:Bounds x="849" y="-167" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1ylvnxq_di" bpmnElement="SequenceFlow_1ylvnxq">
- <di:waypoint xsi:type="dc:Point" x="949" y="-127" />
- <di:waypoint xsi:type="dc:Point" x="1026" y="-127" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="987.5" y="-148" width="0" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_14oc86m_di" bpmnElement="ScriptTask_14oc86m">
<dc:Bounds x="309" y="-281" width="100" height="80" />
</bpmndi:BPMNShape>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn
index a975ebdee0..17f6c66e4a 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3">
<bpmn:process id="DoDeleteE2EServiceInstance" name="All Resources Deleted" isExecutable="true">
<bpmn:startEvent id="StartEvent_0212h2r" name="Start Flow">
<bpmn:outgoing>SequenceFlow_0vz7cd9</bpmn:outgoing>
@@ -24,6 +24,7 @@ ddsi.postProcessAAIGET(execution)]]></bpmn:script>
</bpmn:scriptTask>
<bpmn:scriptTask id="ScriptTask_01erufg" name="&#10;AAI&#10;Delete&#10;(svc instance)&#10;" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_1cevtpy</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_12rr1yy</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0e7inkl</bpmn:outgoing>
<bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
def ddsi = new DoCustomDeleteE2EServiceInstance()
@@ -99,11 +100,6 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script>
<bpmn:sequenceFlow id="SequenceFlow_1j08ko3" sourceRef="ServiceTask_00tg69u" targetRef="Task_1f5dlsv" />
<bpmn:sequenceFlow id="SequenceFlow_0fo5vw5" sourceRef="Task_1ldvug1" targetRef="Task_0mhdfuu" />
<bpmn:sequenceFlow id="SequenceFlow_0orw2f8" sourceRef="Task_0mhdfuu" targetRef="Task_1yx1n05" />
- <bpmn:sequenceFlow id="SequenceFlow_0ha8ix9" sourceRef="Task_1yx1n05" targetRef="IntermediateThrowEvent_0ve5ukt" />
- <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0ve5ukt" name="Go to Delete Resources">
- <bpmn:incoming>SequenceFlow_0ha8ix9</bpmn:incoming>
- <bpmn:linkEventDefinition name="StartDeleteResource" />
- </bpmn:intermediateThrowEvent>
<bpmn:intermediateCatchEvent id="startDeleteResources" name="Start Delete Resources">
<bpmn:outgoing>SequenceFlow_1961633</bpmn:outgoing>
<bpmn:linkEventDefinition name="StartDeleteResource" />
@@ -133,7 +129,7 @@ dcsi.prepareDecomposeService(execution)]]></bpmn:script>
</bpmn:callActivity>
<bpmn:scriptTask id="Task_1yx1n05" name="Post Decompose Service" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_0orw2f8</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0ha8ix9</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_013rime</bpmn:outgoing>
<bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
def dcsi= new DoDeleteE2EServiceInstance()
dcsi.postDecomposeService(execution)]]></bpmn:script>
@@ -167,6 +163,63 @@ dcsi.postDecomposeService(execution)]]></bpmn:script>
<bpmn:linkEventDefinition name="DecomposeService" />
</bpmn:intermediateThrowEvent>
<bpmn:sequenceFlow id="SequenceFlow_0vi0sv6" sourceRef="ScriptTask_1rtnsh8" targetRef="StartEvent_1qh5a34" />
+ <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_00pyc0n" name="Start Delete Resources">
+ <bpmn:incoming>SequenceFlow_1fozgqz</bpmn:incoming>
+ <bpmn:linkEventDefinition name="StartDeleteResource" />
+ </bpmn:intermediateThrowEvent>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_156mc3h" name="Valid Resource List?" default="SequenceFlow_1ncja2b">
+ <bpmn:incoming>SequenceFlow_013rime</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1fozgqz</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1ncja2b</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1g4uc66" name="End Delete Process">
+ <bpmn:incoming>SequenceFlow_1ncja2b</bpmn:incoming>
+ <bpmn:linkEventDefinition name="EndDeleteProcess" />
+ </bpmn:intermediateThrowEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1fozgqz" name="Yes" sourceRef="ExclusiveGateway_156mc3h" targetRef="IntermediateThrowEvent_00pyc0n">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("isDeleteResourceListValid" ) == true)}]]></bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1ncja2b" sourceRef="ExclusiveGateway_156mc3h" targetRef="IntermediateThrowEvent_1g4uc66" />
+ <bpmn:sequenceFlow id="SequenceFlow_013rime" sourceRef="Task_1yx1n05" targetRef="ExclusiveGateway_156mc3h" />
+ <bpmn:serviceTask id="ServiceTask_1lsic7i" name="Update Service Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1ab3vex</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_12rr1yy</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:scriptTask id="ScriptTask_0f3tjbn" name="prepare update service operation status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0h5c1bd</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ab3vex</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+execution.setVariable("progress", "100")
+execution.setVariable("result", "finished")
+execution.setVariable("operationContent", "No actual resoure in service instance")
+def csi= new DoDeleteE2EServiceInstance()
+csi.prepareUpdateServiceOperationStatus(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0hrkmxb" name="End Delete Process">
+ <bpmn:outgoing>SequenceFlow_0h5c1bd</bpmn:outgoing>
+ <bpmn:linkEventDefinition name="EndDeleteProcess" />
+ </bpmn:intermediateCatchEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1ab3vex" sourceRef="ScriptTask_0f3tjbn" targetRef="ServiceTask_1lsic7i" />
+ <bpmn:sequenceFlow id="SequenceFlow_0h5c1bd" sourceRef="IntermediateCatchEvent_0hrkmxb" targetRef="ScriptTask_0f3tjbn" />
+ <bpmn:sequenceFlow id="SequenceFlow_12rr1yy" sourceRef="ServiceTask_1lsic7i" targetRef="ScriptTask_01erufg" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeleteE2EServiceInstance">
@@ -192,7 +245,7 @@ dcsi.postDecomposeService(execution)]]></bpmn:script>
<dc:Bounds x="254" y="450" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="SubProcess_1u8zt9i_di" bpmnElement="SubProcess_1u8zt9i" isExpanded="true">
- <dc:Bounds x="-166" y="672" width="467" height="193" />
+ <dc:Bounds x="-161" y="980" width="467" height="193" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0vz7cd9_di" bpmnElement="SequenceFlow_0vz7cd9">
<di:waypoint xsi:type="dc:Point" x="-501" y="-33" />
@@ -220,32 +273,32 @@ dcsi.postDecomposeService(execution)]]></bpmn:script>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="StartEvent_0sf5lpt_di" bpmnElement="StartEvent_0sf5lpt">
- <dc:Bounds x="-98" y="739" width="36" height="36" />
+ <dc:Bounds x="-93" y="1047" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="-170" y="780" width="90" height="12" />
+ <dc:Bounds x="-165" y="1088" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_06utmg4_di" bpmnElement="EndEvent_06utmg4">
- <dc:Bounds x="195" y="739" width="36" height="36" />
+ <dc:Bounds x="200" y="1047" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="123" y="780" width="90" height="12" />
+ <dc:Bounds x="128" y="1088" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_0nha3pr_di" bpmnElement="ScriptTask_0nha3pr">
- <dc:Bounds x="6" y="717" width="100" height="80" />
+ <dc:Bounds x="11" y="1025" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1921mo3_di" bpmnElement="SequenceFlow_1921mo3">
- <di:waypoint xsi:type="dc:Point" x="-62" y="757" />
- <di:waypoint xsi:type="dc:Point" x="6" y="757" />
+ <di:waypoint xsi:type="dc:Point" x="-57" y="1065" />
+ <di:waypoint xsi:type="dc:Point" x="11" y="1065" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="-118" y="742" width="90" height="12" />
+ <dc:Bounds x="-113" y="1050" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_18vlzfo_di" bpmnElement="SequenceFlow_18vlzfo">
- <di:waypoint xsi:type="dc:Point" x="106" y="757" />
- <di:waypoint xsi:type="dc:Point" x="195" y="757" />
+ <di:waypoint xsi:type="dc:Point" x="111" y="1065" />
+ <di:waypoint xsi:type="dc:Point" x="200" y="1065" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="62" y="742" width="90" height="12" />
+ <dc:Bounds x="67" y="1050" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_146jt8v_di" bpmnElement="ScriptTask_146jt8v">
@@ -298,21 +351,6 @@ dcsi.postDecomposeService(execution)]]></bpmn:script>
<dc:Bounds x="-79" y="192" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0ha8ix9_di" bpmnElement="SequenceFlow_0ha8ix9">
- <di:waypoint xsi:type="dc:Point" x="147" y="198" />
- <di:waypoint xsi:type="dc:Point" x="181" y="198" />
- <di:waypoint xsi:type="dc:Point" x="181" y="198" />
- <di:waypoint xsi:type="dc:Point" x="246" y="198" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="151" y="192" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="IntermediateThrowEvent_15myvzx_di" bpmnElement="IntermediateThrowEvent_0ve5ukt">
- <dc:Bounds x="246" y="180" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="233" y="220" width="64" height="24" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateCatchEvent_1jcfnjr_di" bpmnElement="startDeleteResources">
<dc:Bounds x="-537" y="472" width="36" height="36" />
<bpmndi:BPMNLabel>
@@ -373,6 +411,80 @@ dcsi.postDecomposeService(execution)]]></bpmn:script>
<dc:Bounds x="-16" y="-39" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="IntermediateThrowEvent_00pyc0n_di" bpmnElement="IntermediateThrowEvent_00pyc0n">
+ <dc:Bounds x="398" y="180" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="389" y="220" width="57" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_156mc3h_di" bpmnElement="ExclusiveGateway_156mc3h" isMarkerVisible="true">
+ <dc:Bounds x="279" y="173" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="266" y="145" width="75" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="IntermediateThrowEvent_1g4uc66_di" bpmnElement="IntermediateThrowEvent_1g4uc66">
+ <dc:Bounds x="286" y="270" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="279" y="308" width="53" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1fozgqz_di" bpmnElement="SequenceFlow_1fozgqz">
+ <di:waypoint xsi:type="dc:Point" x="329" y="198" />
+ <di:waypoint xsi:type="dc:Point" x="398" y="198" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="356.5" y="176" width="19" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ncja2b_di" bpmnElement="SequenceFlow_1ncja2b">
+ <di:waypoint xsi:type="dc:Point" x="304" y="223" />
+ <di:waypoint xsi:type="dc:Point" x="304" y="270" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="274" y="240.5" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_013rime_di" bpmnElement="SequenceFlow_013rime">
+ <di:waypoint xsi:type="dc:Point" x="147" y="198" />
+ <di:waypoint xsi:type="dc:Point" x="279" y="198" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="213" y="177" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_1lsic7i_di" bpmnElement="ServiceTask_1lsic7i">
+ <dc:Bounds x="-121" y="697" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0f3tjbn_di" bpmnElement="ScriptTask_0f3tjbn">
+ <dc:Bounds x="-399" y="697" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="IntermediateCatchEvent_0hrkmxb_di" bpmnElement="IntermediateCatchEvent_0hrkmxb">
+ <dc:Bounds x="-531" y="719" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="-539" y="759" width="53" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ab3vex_di" bpmnElement="SequenceFlow_1ab3vex">
+ <di:waypoint xsi:type="dc:Point" x="-299" y="737" />
+ <di:waypoint xsi:type="dc:Point" x="-121" y="737" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="-255" y="715" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0h5c1bd_di" bpmnElement="SequenceFlow_0h5c1bd">
+ <di:waypoint xsi:type="dc:Point" x="-495" y="737" />
+ <di:waypoint xsi:type="dc:Point" x="-399" y="737" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="-492" y="715" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_12rr1yy_di" bpmnElement="SequenceFlow_12rr1yy">
+ <di:waypoint xsi:type="dc:Point" x="-21" y="737" />
+ <di:waypoint xsi:type="dc:Point" x="117" y="737" />
+ <di:waypoint xsi:type="dc:Point" x="117" y="490" />
+ <di:waypoint xsi:type="dc:Point" x="254" y="490" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="132" y="607.5" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
-</bpmn:definitions> \ No newline at end of file
+</bpmn:definitions>
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
index 0e50818f0f..51d09006db 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
@@ -49,6 +49,8 @@ import org.onap.aai.domain.yang.Pserver;
import org.onap.aai.domain.yang.RouteTableReferences;
import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.aai.domain.yang.ServiceSubscription;
+import org.onap.aai.domain.yang.SpPartner;
+import org.onap.aai.domain.yang.Device;
import org.onap.aai.domain.yang.Subnet;
import org.onap.aai.domain.yang.Tenant;
import org.onap.aai.domain.yang.TunnelXconnect;
@@ -108,6 +110,8 @@ public enum AAIObjectType implements GraphInventoryObjectType {
CONNECTOR(AAINamespaceConstants.BUSINESS, Connector.class),
NETWORK_TECHNOLOGY(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, NetworkTechnology.class),
SUBNET(AAIObjectType.L3_NETWORK.uriTemplate(), Subnet.class),
+ SP_PARTNER(AAINamespaceConstants.BUSINESS, SpPartner.class),
+ DEVICE(AAINamespaceConstants.NETWORK, Device.class),
EXT_AAI_NETWORK(AAINamespaceConstants.NETWORK, ExtAaiNetwork.class),
UNKNOWN("", "");