summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/main')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy14
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy66
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy18
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy29
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy44
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy13
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy21
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy43
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy18
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy9
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy227
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy68
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy55
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy9
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java (renamed from bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java)16
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java43
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java28
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java4
32 files changed, 386 insertions, 432 deletions
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 2ae7686703..05fd517e47 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
@@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.scripts
import org.json.JSONArray
import org.json.JSONObject
import org.json.XML
+import org.onap.so.bpmn.common.scripts.ExternalAPIUtilFactory
import static org.apache.commons.lang3.StringUtils.*
import groovy.xml.XmlUtil
@@ -381,7 +382,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
valueMap.put("serviceName", '"' + serviceName + '"')
valueMap.put("serviceUuId", '"' + serviceUuId + '"')
- ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil()
+ ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create()
// insert CallSource='ExternalAPI' to uuiRequest
Map<String, String> requestInputsMap = new HashMap<>()
@@ -426,7 +427,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
msoLogger.debug("doCreateE2ESIin3rdONAP externalAPIURL is: " + extAPIPath)
msoLogger.debug("doCreateE2ESIin3rdONAP payload is: " + payload)
- ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil()
+ ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create()
execution.setVariable("ServiceOrderId", "")
Response response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload)
@@ -471,7 +472,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
extAPIPath += "/" + execution.getVariable("ServiceOrderId")
msoLogger.debug("getE2ESIProgressin3rdONAP create externalAPIURL is: " + extAPIPath)
- ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil()
+ ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create()
Response response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath)
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 a505f3ff5e..b2c278b64c 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
@@ -538,8 +538,8 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
private def getInstnaceId(DelegateExecution execution) {
- def responce = new XmlSlurper().parseText(execution.getVariable("CRENWKI_createSDNCResponse"))
- def data = responce.toString()
+ def response = new XmlSlurper().parseText(execution.getVariable("CRENWKI_createSDNCResponse"))
+ def data = response.toString()
data = data.substring(data.indexOf("<"))
def resp = new XmlSlurper().parseText(data)
@@ -548,11 +548,6 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
def val = ""
switch (modelName) {
- case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ :
- case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ :
- val = resp."network-response-information"."instance-id"
- break
-
case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
case ~/[\w\s\W]*Site[\w\s\W]*/:
@@ -563,6 +558,11 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/:
val = resp."connection-attachment-response-information"."instance-id"
break
+
+ // for SDWANConnectivity and SOTNConnectivity and default:
+ default:
+ val = resp."network-response-information"."instance-id"
+ break
}
return val.toString()
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 e3702f1014..6222214108 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
@@ -20,6 +20,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.client.HttpClientFactory
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;
@@ -29,10 +30,9 @@ 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.bpmn.core.UrnPropertiesReader
-import groovy.json.*
import javax.ws.rs.core.Response
import org.onap.so.utils.TargetEntity
@@ -43,11 +43,6 @@ import org.onap.so.utils.TargetEntity
public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVFCNSResource.class);
-
- String vfcUrl = "/vfc/rest/v1/vfcadapter"
-
- String host = "http://mso.mso.testlab.openecomp.org:8080"
-
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -116,6 +111,18 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
execution.setVariable("nsParameters", nsParameters)
execution.setVariable("nsServiceModelUUID", nsServiceModelUUID);
+ String vfcAdapterUrl = UrnPropertiesReader.getVariable("mso.adapters.vfc.rest.endpoint", execution)
+
+ if (vfcAdapterUrl == null || vfcAdapterUrl.isEmpty()) {
+ msg = getProcessKey(execution) + ': mso:adapters:vfcc:rest:endpoint URN mapping is not defined'
+ msoLogger.debug(msg)
+ }
+
+ while (vfcAdapterUrl.endsWith('/')) {
+ vfcAdapterUrl = vfcAdapterUrl.substring(0, vfcAdapterUrl.length()-1)
+ }
+
+ execution.setVariable("vfcAdapterUrl", vfcAdapterUrl)
} catch (BpmnError e) {
throw e;
@@ -132,6 +139,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
*/
public void createNetworkService(DelegateExecution execution) {
msoLogger.trace("createNetworkService ")
+ String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
String nsServiceModelUUID = execution.getVariable("nsServiceModelUUID");
String nsParameters = execution.getVariable("nsParameters");
@@ -149,8 +157,8 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
"additionalParamForNs":${requestInputs}
}
}"""
- Response apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody)
- String returnCode = apiResponse.getStatus()
+ Response apiResponse = postRequest(execution, vfcAdapterUrl + "/ns", reqBody)
+ String returnCode = apiResponse.getStatus ()
String aaiResponseAsString = apiResponse.readEntity(String.class)
String nsInstanceId = "";
if(returnCode== "200" || returnCode == "201"){
@@ -165,6 +173,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
*/
public void instantiateNetworkService(DelegateExecution execution) {
msoLogger.trace("instantiateNetworkService ")
+ String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
String nsParameters = execution.getVariable("nsParameters");
String nsServiceName = execution.getVariable("nsServiceName")
@@ -176,7 +185,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
"nsParameters":${nsParameters}
}"""
String nsInstanceId = execution.getVariable("nsInstanceId")
- String url = host + vfcUrl + "/ns/" +nsInstanceId + "/instantiate"
+ String url = vfcAdapterUrl + "/ns/" +nsInstanceId + "/instantiate"
Response apiResponse = postRequest(execution, url, reqBody)
String returnCode = apiResponse.getStatus()
String aaiResponseAsString = apiResponse.readEntity(String.class)
@@ -193,9 +202,10 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
*/
public void queryNSProgress(DelegateExecution execution) {
msoLogger.trace("queryNSProgress ")
+ String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String jobId = execution.getVariable("jobId")
String nsOperationKey = execution.getVariable("nsOperationKey");
- String url = host + vfcUrl + "/jobs/" + jobId
+ String url = vfcAdapterUrl + "/jobs/" + jobId
Response apiResponse = postRequest(execution, url, nsOperationKey)
String returnCode = apiResponse.getStatus()
String aaiResponseAsString = apiResponse.readEntity(String.class)
@@ -214,7 +224,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
try {
Thread.sleep(5000);
} catch(InterruptedException e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Time Delay exception" + e , "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ msoLogger.error( "Time Delay exception" + e.getMessage());
}
}
@@ -239,7 +249,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
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 Creating NS relationship.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getMessage(),e);
+ msoLogger.error("Exception occured while Creating NS relationship."+ e.getMessage());
throw new BpmnError("MSOWorkflowException")
}
}
@@ -251,24 +261,30 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
*/
private Response postRequest(DelegateExecution execution, String urlString, String requestBody){
msoLogger.trace("Started Execute VFC adapter Post Process ")
- msoLogger.info("url:"+url +"\nrequestBody:"+ requestBody)
+ 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")
+ URL url = new URL(urlString);
+
+ // Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7'
+ // user 'bepl' authHeader is the same with mso.db.auth
+ String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER)
+ httpClient.addAdditionalHeader("Accept", "application/json")
+ httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
- apiResponse = httpClient.post(requestBody)
+ apiResponse = httpClient.post(requestBody)
+
+ msoLogger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class))
- 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")
- }
+ msoLogger.error("VFC Aatpter Post Call Exception:" + e.getMessage());
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VFC Aatpter Post Call Exception")
+ }
+
+ msoLogger.trace("Completed Execute VF-C adapter Post Process ")
+
return apiResponse
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy
index 9c25a57adc..af46bf65b8 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy
@@ -20,6 +20,8 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
+
import static org.apache.commons.lang3.StringUtils.*;
import org.camunda.bpm.engine.delegate.BpmnError
@@ -55,8 +57,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
VidUtils vidUtils = new VidUtils(this)
- CatalogDbUtils cutils = new CatalogDbUtils()
- AAICreateResources aaiCR = new AAICreateResources()
+ CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
/**
* This method gets and validates the incoming
@@ -448,7 +449,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
String vnfModelCustomizationUuid = jsonUtil.getJsonValueForKey(vnfModelInfo, "modelCustomizationUuid")
msoLogger.debug("querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid)
- JSONArray vnfs = cutils.getAllVnfsByVnfModelCustomizationUuid(execution,
+ JSONArray vnfs = catalogDbUtils.getAllVnfsByVnfModelCustomizationUuid(execution,
vnfModelCustomizationUuid, "v2")
msoLogger.debug("obtained VNF list: " + vnfs)
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 078d68bd75..b718e4a2e0 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
@@ -20,6 +20,8 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.bpmn.common.scripts.ExternalAPIUtilFactory
+
import javax.ws.rs.NotFoundException
import javax.ws.rs.core.Response
@@ -249,7 +251,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
valueMap.put("serviceName", "null")
valueMap.put("serviceUuId", '"' + serviceSpecificationId + '"')
- ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil()
+ ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create()
valueMap.put("_requestInputs_", "")
@@ -271,7 +273,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
String extAPIPath = sppartnerUrl + "/service?relatedParty.id=" + globalSubscriberId
msoLogger.debug("queryServicefrom3rdONAP externalAPIURL is: " + extAPIPath)
- ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil()
+ ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create()
Response response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath)
@@ -317,7 +319,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
msoLogger.debug("doDeleteE2ESIin3rdONAP externalAPIURL is: " + extAPIPath)
msoLogger.debug("doDeleteE2ESIin3rdONAP payload is: " + payload)
- ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil()
+ ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create()
execution.setVariable("ServiceOrderId", "")
Response response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload)
@@ -361,7 +363,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
extAPIPath += "/" + execution.getVariable("ServiceOrderId")
msoLogger.debug("getE2ESIProgressin3rdONAP delete externalAPIURL is: " + extAPIPath)
- ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil()
+ ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create()
Response response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath)
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 519f064802..5bb8c83628 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
@@ -52,7 +52,6 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteCustomE2EServiceInstance.class);
public void preProcessRequest (DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
String msg = ""
@@ -111,7 +110,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
execution.setVariable("operationType", "DELETE")
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
msoLogger.info(msg)
@@ -121,7 +120,6 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
}
public void sendSyncResponse (DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
msoLogger.trace("Staring sendSyncResponse")
try {
@@ -166,7 +164,6 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
}
public void prepareCompletionRequest (DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
msoLogger.trace("Starting prepareCompletion")
try {
@@ -339,8 +336,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
* Init the service Operation Status
*/
public void prepareInitServiceOperationStatus(DelegateExecution execution){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled)
+ msoLogger.debug("======== STARTED prepareInitServiceOperationStatus Process ======== ")
try{
String serviceId = execution.getVariable("serviceInstanceId")
String operationId = execution.getVariable("operationId")
@@ -349,12 +345,12 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String progress = "0"
String reason = ""
String operationContent = "Prepare service creation"
- utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled)
+ msoLogger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId)
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)
+ msoLogger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
String payload =
"""<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
@@ -376,12 +372,12 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
- utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled)
+ msoLogger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload)
}catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled)
+ msoLogger.error("Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e)
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage())
}
- utils.log("DEBUG", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled)
+ msoLogger.debug("======== COMPLETED prepareInitServiceOperationStatus Process ======== ")
}
}
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 9c9ed933e0..24071d38f6 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
@@ -20,42 +20,14 @@
package org.onap.so.bpmn.infrastructure.scripts;
import static org.apache.commons.lang3.StringUtils.*;
-import groovy.xml.XmlUtil
-import groovy.json.*
import org.onap.so.bpmn.core.domain.ServiceDecomposition
-import org.onap.so.bpmn.core.domain.ServiceInstance
-import org.onap.so.bpmn.core.domain.ModelInfo
import org.onap.so.bpmn.core.domain.Resource
-import org.onap.so.bpmn.core.domain.AllottedResource
-import org.onap.so.bpmn.core.domain.NetworkResource
-import org.onap.so.bpmn.core.domain.VnfResource
-import org.onap.so.bpmn.common.recipe.ResourceInput
-import org.onap.so.bpmn.common.recipe.BpmnRestClient
import org.onap.so.bpmn.core.json.JsonUtils
-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.SDNCAdapterUtils
-import org.onap.so.bpmn.common.scripts.CatalogDbUtils;
-import org.onap.so.bpmn.core.RollbackData
-import org.onap.so.bpmn.core.WorkflowException
-import java.util.List;
-import java.util.UUID;
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.json.JSONObject;
-import org.json.JSONArray;
-import org.apache.commons.lang3.*
-import org.apache.commons.codec.binary.Base64;
-import org.springframework.web.util.UriUtils;
-import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
-
-
/**
* This groovy class supports the <class>DoCompareModelVersions.bpmn</class> process.
@@ -76,7 +48,6 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
String Prefix="DCMPMDV_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- CatalogDbUtils cutils = new CatalogDbUtils()
public void preProcessRequest (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
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 194e7ff3e1..2168dab736 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
@@ -24,12 +24,10 @@ import static org.apache.commons.lang3.StringUtils.*;
import javax.ws.rs.NotFoundException
-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.AbstractServiceTaskProcessor
-import org.onap.so.bpmn.common.scripts.CatalogDbUtils;
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.RollbackData
@@ -37,7 +35,6 @@ import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.domain.Resource
import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.AAIResultWrapper
@@ -50,10 +47,6 @@ import org.onap.so.logger.MsoLogger
import org.springframework.web.util.UriUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
-import groovy.json.*
-
-
-
/**
* This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process.
*
@@ -86,7 +79,6 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
String Prefix="DCRESI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- CatalogDbUtils cutils = new CatalogDbUtils()
public void preProcessRequest (DelegateExecution execution) {
String msg = ""
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
index c9497165c4..1b64671163 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
@@ -527,6 +527,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
L3Network network = client.get(uri, NotFoundException.class).asBean(L3Network.class).get()
execution.setVariable(Prefix + "aaiRequeryIdReturnCode", "200")
+ execution.setVariable(Prefix + "requeryIdAAIResponse", network)
String netName = network.getNetworkName()
String networkOutputs =
@@ -764,29 +765,26 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.debug(" ***** Inside callRESTUpdateContrailAAINetwork() of DoCreateNetworkInstance ***** " )
+ msoLogger.trace(" ***** Inside callRESTUpdateContrailAAINetwork() of DoCreateNetworkInstance ***** " )
try {
// get variables
String networkId = execution.getVariable(Prefix + "networkId")
- String requeryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse")
+ L3Network requeryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse")
String createNetworkResponse = execution.getVariable(Prefix + "createNetworkResponse")
L3Network l3Network = new L3Network()
- if (utils.nodeExists(requeryIdAAIResponse, 'heat-stack-id')) {
- } else {
+ if (StringUtils.isBlank(requeryIdAAIResponse.getHeatStackId())) {
if (utils.nodeExists(createNetworkResponse, 'networkStackId')) {
l3Network.setHeatStackId(utils.getNodeText(createNetworkResponse, 'networkStackId'))
}
}
- if (utils.nodeExists(requeryIdAAIResponse, 'neutron-network-id')) {
- } else {
+ if (StringUtils.isBlank(requeryIdAAIResponse.getNeutronNetworkId())) {
if (utils.nodeExists(createNetworkResponse, 'neutronNetworkId')) {
l3Network.setNeutronNetworkId(utils.getNodeText(createNetworkResponse, 'neutronNetworkId'))
}
}
- if (utils.nodeExists(requeryIdAAIResponse, 'contrail-network-fqdn')) {
- } else {
+ if (StringUtils.isBlank(requeryIdAAIResponse.getContrailNetworkFqdn())) {
if (utils.nodeExists(createNetworkResponse, 'networkFqdn')) {
l3Network.setContrailNetworkFqdn(utils.getNodeText(createNetworkResponse, 'networkFqdn'))
}
@@ -794,39 +792,33 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
String status = utils.getNodeText(createNetworkResponse, 'orchestration-status')
if(status.equals("pending-create") || status.equals("PendingCreate")){
- l3Network.setOperationalStatus("Created")
+ l3Network.setOrchestrationStatus("Created")
}else{
- l3Network.setOperationalStatus("Active")
+ l3Network.setOrchestrationStatus("Active")
}
+ msoLogger.debug("Updating l3-network in AAI" )
+
AAIResourcesClient client = new AAIResourcesClient()
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId)
client.update(uri, l3Network)
- String subnetsXml = utils.getNodeXml(requeryIdAAIResponse, "subnets")
- InputSource source = new InputSource(new StringReader(subnetsXml));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- docFactory.setNamespaceAware(true)
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document xml = docBuilder.parse(source)
- NodeList nodeList = xml.getElementsByTagNameNS("*", "subnet")
- for (int x = 0; x < nodeList.getLength(); x++) {
- Node node = nodeList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String subnetOrchStatus = eElement.getElementsByTagNameNS("*", "orchestration-status").item(0).getTextContent()
- String subnetId = eElement.getElementsByTagNameNS("*", "subnet-id").item(0).getTextContent()
+ if(requeryIdAAIResponse.getSubnets() != null){
+ for(Subnet s:requeryIdAAIResponse.getSubnets().getSubnet()){
+ String subnetOrchStatus = s.getOrchestrationStatus()
+ String subnetId = s.getSubnetId()
Subnet subnet = new Subnet()
- String neutronSubnetId = networkUtils.extractNeutSubId(createNetworkResponse, subnetId)
- subnet.setNeutronSubnetId(neutronSubnetId)
+ subnet.setNeutronSubnetId(networkUtils.extractNeutSubId(createNetworkResponse, subnetId))
if(subnetOrchStatus.equals("pending-create") || subnetOrchStatus.equals("PendingCreate") ){
subnet.setOrchestrationStatus("Created")
}else{
subnet.setOrchestrationStatus("Active")
}
+ msoLogger.debug("Updating subnet in AAI" )
AAIResourceUri subUri = AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, networkId, subnetId)
client.update(subUri, subnet)
+
}
}
@@ -868,7 +860,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
String source = execution.getVariable(Prefix + "source")
String requestInput = execution.getVariable(Prefix + "networkRequest")
- String queryIdResponse = execution.getVariable(Prefix + "queryIdAAIResponse")
+ L3Network queryIdResponse = execution.getVariable(Prefix + "queryIdAAIResponse")
String cloudRegionId = execution.getVariable(Prefix + "cloudRegionPo")
String backoutOnFailure = execution.getVariable(Prefix + "rollbackEnabled")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy
index 1d75d399ee..fd6a4a1cde 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy
@@ -18,17 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.scripts;
+package org.onap.so.bpmn.infrastructure.scripts
-import groovy.xml.XmlUtil
-import groovy.json.*
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
import org.onap.so.logger.MsoLogger
-import org.onap.so.logger.MessageEnum
-
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.NetworkUtils
@@ -37,13 +34,9 @@ import org.onap.so.bpmn.common.scripts.VidUtils
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.utils.TargetEntity
-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
/**
* This groovy class supports the <class>DoCreateNetworkInstance.bpmn</class> process.
@@ -203,7 +196,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable(Prefix + "urlRollbackPoNetwork", urlRollbackPoNetwork)
URL url = new URL(urlRollbackPoNetwork)
- HttpClient httpClient = new HttpClient(url, "application/xml", TargetEntity.OPENSTACK_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.OPENSTACK_ADAPTER)
httpClient.addAdditionalHeader("Authorization", execution.getVariable("BasicAuthHeaderValuePO"))
Response response = httpClient.delete(rollbackNetworkRequest)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
index 7707903391..aa1eed95bb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
@@ -20,21 +20,12 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
import org.onap.so.bpmn.infrastructure.properties.BPMNProperties
-
-import java.util.ArrayList
-import java.util.Iterator
-import java.util.List
import org.apache.commons.lang3.StringUtils
import org.apache.http.HttpResponse
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.codehaus.groovy.runtime.ArrayUtil
-import org.codehaus.groovy.runtime.ScriptBytecodeAdapter
-import org.codehaus.groovy.runtime.callsite.CallSite
-import org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation
-import org.codehaus.groovy.runtime.typehandling.ShortTypeHandling
-import org.json.JSONArray
import org.json.JSONObject
import org.onap.so.bpmn.common.recipe.BpmnRestClient
import org.onap.so.bpmn.common.recipe.ResourceInput
@@ -48,7 +39,6 @@ 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.common.resource.ResourceRequestBuilder
-import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
@@ -75,7 +65,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- CatalogDbUtils cutils = new CatalogDbUtils()
+ CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
public void preProcessRequest(DelegateExecution execution) {
msoLogger.trace("preProcessRequest ")
@@ -260,18 +250,17 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
// requestAction is action, not opertiontype
//String requestAction = resourceInput.getOperationType()
String requestAction = "createInstance"
- JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceModelUUID, requestAction)
+ JSONObject resourceRecipe = catalogDbUtils.getResourceRecipe(execution, resourceModelUUID, requestAction)
if (resourceRecipe != null) {
- String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + resourceRecipe.getString("orchestrationUri")
+ String recipeURL = BPMNProperties.getProperty("bpelURL", "http://so-bpmn-infra.onap:8081") + resourceRecipe.getString("orchestrationUri")
int recipeTimeOut = resourceRecipe.getInt("recipeTimeout")
String recipeParamXsd = resourceRecipe.get("paramXSD")
BpmnRestClient bpmnRestClient = new BpmnRestClient()
HttpResponse resp = bpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput, recipeParamXsd)
} else {
- String exceptionMessage = "Resource receipe is not found for resource modeluuid: " +
- resourceInput.getResourceModelInfo().getModelUuid()
+ String exceptionMessage = "Resource receipe is not found for resource modeluuid: " + resourceModelUUID
msoLogger.trace(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, exceptionMessage)
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
index 4bda803da0..c04bbd4806 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
@@ -22,13 +22,12 @@ 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.DelegateExecution
import org.onap.aai.domain.yang.OwningEntity
-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.CatalogDbUtilsFactory
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
@@ -42,16 +41,11 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.AAIResourcesClient
-import org.onap.so.client.aai.entities.AAIResultWrapper
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
-
-import groovy.json.*
-
/**
* This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process.
*
@@ -84,7 +78,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
String Prefix="DCRESI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- CatalogDbUtils cutils = new CatalogDbUtils()
+ CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
public void preProcessRequest (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
@@ -330,7 +324,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
try{
- String json = cutils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid )
+ String json = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid )
msoLogger.debug("JSON IS: "+json)
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 a3c30dcb50..33d0e25d7d 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
@@ -20,6 +20,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.client.HttpClientFactory
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;
@@ -31,10 +32,10 @@ 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.bpmn.core.UrnPropertiesReader
import org.onap.so.utils.TargetEntity
-import groovy.json.*
import javax.ws.rs.core.Response
/**
@@ -44,9 +45,6 @@ import javax.ws.rs.core.Response
public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProcessor {
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()
@@ -100,6 +98,19 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
execution.setVariable("nsOperationKey", nsOperationKey);
execution.setVariable("nsParameters", nsParameters)
+ String vfcAdapterUrl = UrnPropertiesReader.getVariable("mso.adapters.vfc.rest.endpoint", execution)
+
+ if (vfcAdapterUrl == null || vfcAdapterUrl.isEmpty()) {
+ msg = getProcessKey(execution) + ': mso:adapters:vfcc:rest:endpoint URN mapping is not defined'
+ msoLogger.debug(msg)
+ }
+
+ while (vfcAdapterUrl.endsWith('/')) {
+ vfcAdapterUrl = vfcAdapterUrl.substring(0, vfcAdapterUrl.length()-1)
+ }
+
+ execution.setVariable("vfcAdapterUrl", vfcAdapterUrl)
+
} catch (BpmnError e) {
throw e;
@@ -116,6 +127,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
*/
public void createNetworkService(DelegateExecution execution) {
msoLogger.trace("createNetworkService")
+ String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
String nsParameters = execution.getVariable("nsParameters");
String nsServiceName = execution.getVariable("nsServiceName")
@@ -126,7 +138,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
"nsOperationKey":${nsOperationKey},
"nsParameters":${nsParameters}
}"""
- Response apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody)
+ Response apiResponse = postRequest(execution, vfcAdapterUrl + "/ns", reqBody)
String returnCode = apiResponse.getStatus()
String aaiResponseAsString = apiResponse.readEntity(String.class)
String nsInstanceId = "";
@@ -142,6 +154,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
*/
public void instantiateNetworkService(DelegateExecution execution) {
msoLogger.trace("instantiateNetworkService")
+ String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
String nsParameters = execution.getVariable("nsParameters");
String nsServiceName = execution.getVariable("nsServiceName")
@@ -153,7 +166,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
"nsParameters":${nsParameters}
}"""
String nsInstanceId = execution.getVariable("nsInstanceId")
- String url = host + vfcUrl + "/ns/" +nsInstanceId + "/instantiate"
+ String url = vfcAdapterUrl + "/ns/" +nsInstanceId + "/instantiate"
Response apiResponse = postRequest(execution, url, reqBody)
String returnCode = apiResponse.getStatus()
String aaiResponseAsString = apiResponse.readEntity(String.class)
@@ -170,9 +183,10 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
*/
public void queryNSProgress(DelegateExecution execution) {
msoLogger.trace("queryNSProgress")
+ String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String jobId = execution.getVariable("jobId")
String nsOperationKey = execution.getVariable("nsOperationKey");
- String url = host + vfcUrl + "/jobs/" + jobId
+ String url = vfcAdapterUrl + "/jobs/" + jobId
Response apiResponse = postRequest(execution, url, nsOperationKey)
String returnCode = apiResponse.getStatus()
String aaiResponseAsString = apiResponse.readEntity(String.class)
@@ -233,17 +247,20 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
try{
URL url = new URL(urlString);
+
+ // Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7'
+ // user 'bepl' authHeader is the same with mso.db.auth
+ String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER)
+ httpClient.addAdditionalHeader("Accept", "application/json")
+ httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
- HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER)
- httpClient.addAdditionalHeader("Accept", "application/json")
- httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk")
-
- apiResponse = httpClient.post(requestBody)
+ 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);
+ msoLogger.error("Exception occured while executing VFC Adapter Post Call" + e.getMessage ());
throw new BpmnError("MSOWorkflowException")
}
return apiResponse
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
index 50fe75e3df..089239fa07 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
@@ -20,6 +20,9 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
+import org.onap.so.client.HttpClientFactory
+
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
import javax.xml.parsers.DocumentBuilder
@@ -42,9 +45,7 @@ import org.onap.so.bpmn.core.RollbackData
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.domain.VnfResource
-import org.onap.so.bpmn.core.json.DecomposeJsonUtil
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.client.HttpClient
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType;
@@ -59,7 +60,6 @@ import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
import org.onap.so.utils.TargetEntity
-import org.springframework.web.util.UriUtils
import org.w3c.dom.Document
import org.w3c.dom.Element
import org.w3c.dom.NamedNodeMap
@@ -78,8 +78,8 @@ public class DoCreateVfModule extends VfModuleBase {
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
- CatalogDbUtils catalog = new CatalogDbUtils()
- DecomposeJsonUtil decomposeJsonUtils = new DecomposeJsonUtil()
+ CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
+ private final HttpClientFactory httpClientFactory = new HttpClientFactory()
/**
* Validates the request message and sets up the workflow.
@@ -261,7 +261,7 @@ public class DoCreateVfModule extends VfModuleBase {
String serviceType =""
try{
- String json = catalog.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid )
+ String json = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid )
serviceType = jsonUtil.getJsonValue(json, "serviceResources.serviceType")
}catch(BpmnError e){
throw e
@@ -642,7 +642,7 @@ public class DoCreateVfModule extends VfModuleBase {
String endPoint = aaiUriUtil.createAaiUri(uri)
try {
- HttpClient client = new HttpClient(new URL(endPoint), MediaType.APPLICATION_XML, TargetEntity.AAI)
+ HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), TargetEntity.AAI)
client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString())
client.addAdditionalHeader('X-FromAppId', 'MSO')
client.addAdditionalHeader('Content-Type', MediaType.APPLICATION_XML)
@@ -724,7 +724,7 @@ public class DoCreateVfModule extends VfModuleBase {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, vnfId).queryParam("vf-module-name",vfModuleName)
String endPoint = aaiUriUtil.createAaiUri(uri)
- HttpClient client = new HttpClient(new URL(endPoint), MediaType.APPLICATION_XML, TargetEntity.AAI)
+ HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), TargetEntity.AAI)
client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString())
client.addAdditionalHeader('X-FromAppId', 'MSO')
client.addAdditionalHeader('Content-Type', MediaType.APPLICATION_XML)
@@ -2004,7 +2004,7 @@ public class DoCreateVfModule extends VfModuleBase {
msoLogger.debug("vnfModelCustomizationUuid: " + vnfModelCustomizationUuid)
- JSONArray vnfs = catalog.getAllVnfsByVnfModelCustomizationUuid(execution, vnfModelCustomizationUuid, "v2")
+ JSONArray vnfs = catalogDbUtils.getAllVnfsByVnfModelCustomizationUuid(execution, vnfModelCustomizationUuid, "v2")
msoLogger.debug("Incoming Query Catalog DB for Vnf Response is: " + vnfModelCustomizationUuid)
// Only one match here
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
index 93379c72be..b42962adac 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
@@ -24,6 +24,7 @@ import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.GenericVnf
import org.onap.aai.domain.yang.VolumeGroup
+import org.onap.aai.domain.yang.VolumeGroups
import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
@@ -216,10 +217,11 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
try {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion).queryParam("volume-group-name", volumeGroupName)
- Optional<VolumeGroup> volumeGroup = getAAIClient().get(VolumeGroup.class,uri)
- if(volumeGroup.isPresent()){
+ Optional<VolumeGroups> volumeGroups = getAAIClient().get(VolumeGroups.class,uri)
+ if(volumeGroups.isPresent()){
+ VolumeGroup volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
execution.setVariable(prefix+'AaiReturnCode', 200)
- execution.setVariable("queriedVolumeGroupId",volumeGroup.get().getVolumeGroupId())
+ execution.setVariable("queriedVolumeGroupId",volumeGroup.getVolumeGroupId())
msoLogger.debug("Volume Group Name $volumeGroupName exists in AAI.")
}else{
execution.setVariable(prefix+'AaiReturnCode', 404)
@@ -298,6 +300,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
getAAIClient().create(volumeGroupUri, volumeGroup)
getAAIClient().connect(volumeGroupUri, vnfUri)
getAAIClient().connect(volumeGroupUri, tenantUri)
+ execution.setVariable("queriedVolumeGroupId", volumeGroupId)
RollbackData rollbackData = execution.getVariable("rollbackData")
rollbackData.put("DCVFMODULEVOL", "isAAIRollbackNeeded", "true")
} catch (NotFoundException ignored) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy
index d3dbd9107e..232336b0ee 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy
@@ -20,14 +20,11 @@
package org.onap.so.bpmn.infrastructure.scripts
-import java.util.UUID;
-
-import java.util.List
-
import org.json.JSONObject;
import org.json.JSONArray;
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.CatalogDbUtils
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.VidUtils
import org.onap.so.bpmn.core.RollbackData
@@ -59,7 +56,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
VidUtils vidUtils = new VidUtils(this)
- CatalogDbUtils cutils = new CatalogDbUtils()
+ CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
/**
* This method gets and validates the incoming
@@ -189,8 +186,8 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
}
msoLogger.debug("querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid)
- JSONArray vnfs = cutils.getAllVnfsByVnfModelCustomizationUuid(execution,
- vnfModelCustomizationUuid)
+ JSONArray vnfs = catalogDbUtils.getAllVnfsByVnfModelCustomizationUuid(execution,
+ vnfModelCustomizationUuid, "v1")
msoLogger.debug("obtained VNF list")
// Only one match here
JSONObject vnfObject = vnfs[0]
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 a981abf011..48f255bf91 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
@@ -19,37 +19,35 @@
*/
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
-
-import org.apache.commons.lang3.*
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
+import org.apache.commons.lang3.StringUtils
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.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.WorkflowException
import org.onap.so.bpmn.core.domain.Resource
import org.onap.so.bpmn.core.domain.ServiceDecomposition
-import org.onap.so.bpmn.core.UrnPropertiesReader
-
-import org.onap.so.utils.TargetEntity
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
+import org.onap.so.logger.MsoLogger
+import org.onap.so.utils.TargetEntity
import org.springframework.web.util.UriUtils
import org.w3c.dom.Document
-import org.w3c.dom.Element
import org.w3c.dom.Node
-import org.w3c.dom.NodeList
import org.xml.sax.InputSource
-import groovy.json.*
+import javax.ws.rs.core.Response
+import javax.xml.parsers.DocumentBuilder
+import javax.xml.parsers.DocumentBuilderFactory
+
+import static org.apache.commons.lang3.StringUtils.isBlank
/**
* This groovy class supports the <class>DoDeleteE2EServiceInstance.bpmn</class> process.
@@ -78,10 +76,11 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
String Prefix="DDEESI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteE2EServiceInstance.class);
+
public void preProcessRequest (DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled)
+ msoLogger.debug(" ***** preProcessRequest *****")
String msg = ""
try {
@@ -107,23 +106,23 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
String serviceInstanceId = execution.getVariable("serviceInstanceId")
if (isBlank(serviceInstanceId)){
msg = "Input serviceInstanceId is null"
- utils.log("INFO", msg, isDebugEnabled)
+ msoLogger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
- String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback')
+ String sdncCallbackUrl = UrnPropertiesReader.getVariable('URN_mso_workflow_sdncadapter_callback', execution)
if (isBlank(sdncCallbackUrl)) {
msg = "URN_mso_workflow_sdncadapter_callback is null"
- utils.log("INFO", msg, isDebugEnabled)
+ msoLogger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
- utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled)
+ msoLogger.info("SDNC Callback URL: " + sdncCallbackUrl)
StringBuilder sbParams = new StringBuilder()
Map<String, String> paramsMap = execution.getVariable("serviceInputParams")
- if (paramsMap != null)
- {
+
+ if (paramsMap != null) {
sbParams.append("<service-input-parameters>")
for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
String paramsXml
@@ -148,15 +147,14 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- utils.log("INFO", msg, isDebugEnabled)
+ msoLogger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled)
+ msoLogger.debug("***** Exit preProcessRequest *****")
}
public void postProcessAAIGET(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled)
+ msoLogger.debug(" ***** postProcessAAIGET ***** ")
String msg = ""
try {
@@ -165,14 +163,14 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
String serviceType = ""
if(foundInAAI){
- utils.log("INFO","Found Service-instance in AAI", isDebugEnabled)
+ msoLogger.debug("Found Service-instance in AAI")
String siData = execution.getVariable("GENGS_service")
- utils.log("INFO", "SI Data", isDebugEnabled)
+ msoLogger.debug("SI Data")
if (isBlank(siData))
{
msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId
- utils.log("INFO", msg, isDebugEnabled)
+ msoLogger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
else
@@ -185,7 +183,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
// get model invariant id
// Get Template uuid and version
if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) {
- utils.log("INFO", "SI Data model-invariant-id and model-version-id exist:", isDebugEnabled)
+ msoLogger.debug("SI Data model-invariant-id and model-version-id exist")
def modelInvariantId = serviceXml.getElementsByTagName("model-invariant-id").item(0).getTextContent()
def modelVersionId = serviceXml.getElementsByTagName("model-version-id").item(0).getTextContent()
@@ -194,10 +192,10 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("model-version-id-original", modelVersionId)
}
- utils.log("INFO", "SI Data" + siData, isDebugEnabled)
+ msoLogger.debug("SI Data" + siData)
//Confirm there are no related service instances (vnf/network or volume)
if (utils.nodeExists(siData, "relationship-list")) {
- utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled)
+ msoLogger.debug("SI Data relationship-list exists")
JSONArray jArray = new JSONArray()
XmlParser xmlParser = new XmlParser()
@@ -211,109 +209,35 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
}
execution.setVariable("serviceRelationShip", jArray.toString())
-
-// //test(siData)
-// NodeList nodeList = serviceXml.getElementsByTagName("relationship")
-// JSONArray jArray = new JSONArray()
-// for (int x = 0; x < nodeList.getLength(); x++) {
-// Node node = nodeList.item(x)
-// if (node.getNodeType() == Node.ELEMENT_NODE) {
-// Element eElement = (Element) node
-// def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() //for ns
-// if(e.equals("service-instance")){
-// def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent()
-// utils.log("INFO", "ServiceInstance Related NS :" + relatedObject, isDebugEnabled)
-// NodeList dataList = node.getChildNodes()
-// if(null != dataList) {
-// JSONObject jObj = new JSONObject()
-// for (int i = 0; i < dataList.getLength(); i++) {
-// Node dNode = dataList.item(i)
-// if(dNode.getNodeName() == "relationship-data") {
-// Element rDataEle = (Element)dNode
-// def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()
-// def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()
-// if(eKey.equals("service-instance.service-instance-id")){
-// jObj.put("resourceInstanceId", eValue)
-// }
-//
-// }
-// else if(dNode.getNodeName() == "related-to-property"){
-// Element rDataEle = (Element)dNode
-// def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent()
-// def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent()
-// if(eKey.equals("service-instance.service-instance-name")){
-// jObj.put("resourceType", eValue)
-// }
-// }
-// }
-// utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled)
-// jArray.put(jObj)
-// }
-// //for overlay/underlay
-// }else if (e.equals("configuration")){
-// def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent()
-// utils.log("INFO", "ServiceInstance Related Configuration :" + relatedObject, isDebugEnabled)
-// NodeList dataList = node.getChildNodes()
-// if(null != dataList) {
-// JSONObject jObj = new JSONObject()
-// for (int i = 0; i < dataList.getLength(); i++) {
-// Node dNode = dataList.item(i)
-// if(dNode.getNodeName() == "relationship-data") {
-// Element rDataEle = (Element)dNode
-// def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()
-// def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()
-// if(eKey.equals("configuration.configuration-id")){
-// jObj.put("resourceInstanceId", eValue)
-// }
-// }
-// else if(dNode.getNodeName() == "related-to-property"){
-// Element rDataEle = (Element)dNode
-// def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent()
-// def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent()
-// if(eKey.equals("configuration.configuration-type")){
-// jObj.put("resourceType", eValue)
-// }
-// }
-// }
-// utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled)
-// jArray.put(jObj)
-// }
-// // for SP-Partner
-// }else if (e.equals("sp-partner")){
-//
-// }
-// }
-// }
-// execution.setVariable("serviceRelationShip", jArray.toString())
+ execution.setVariable("serviceRelationShip", jArray.toString())
}
}
}else{
boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
if(!succInAAI){
- utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled)
+ msoLogger.debug("Error getting Service-instance from AAI :" + serviceInstanceId)
WorkflowException workflowException = execution.getVariable("WorkflowException")
- utils.logAudit("workflowException: " + workflowException)
if(workflowException != null){
+ msoLogger.error("workflowException: " + workflowException)
exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
}
- else
- {
+ else {
msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI
- utils.log("INFO", msg, isDebugEnabled)
+ msoLogger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
}
}
- utils.log("INFO","Service-instance NOT found in AAI. Silent Success", isDebugEnabled)
+ msoLogger.debug("Service-instance NOT found in AAI. Silent Success")
}
}catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex) {
msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage()
- utils.log("INFO", msg, isDebugEnabled)
+ msoLogger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled)
+ msoLogger.debug(" *** Exit postProcessAAIGET *** ")
}
private JSONObject getRelationShipData(node, isDebugEnabled){
@@ -323,7 +247,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
def rt = utils.getNodeText(relation, "related-to")
def rl = utils.getNodeText(relation, "related-link")
- utils.log("INFO", "ServiceInstance Related NS/Configuration :" + rl, isDebugEnabled)
+ msoLogger.debug("ServiceInstance Related NS/Configuration :" + rl)
def rl_datas = utils.getIdenticalChildren(node, "relationship-data")
for(def rl_data : rl_datas) {
@@ -357,13 +281,11 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
}
}
- utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled)
-
+ msoLogger.debug("Relationship related to Resource:" + jObj.toString())
return jObj
}
public void getCurrentNS(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("INFO", "======== Start getCurrentNS Process ======== ", isDebugEnabled)
def currentIndex = execution.getVariable("currentNSIndex")
@@ -375,14 +297,12 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("GENGS_serviceInstanceId", "")
execution.setVariable("GENGS_serviceInstanceName", nsResourceType)
- utils.log("INFO", "======== COMPLETED getCurrentNS Process ======== ", isDebugEnabled)
+ msoLogger.debug("======== COMPLETED getCurrentNS Process ======== ")
}
public void prepareDecomposeService(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
try {
- utils.log("DEBUG", " ***** Inside prepareDecomposeService of create generic e2e service ***** ", isDebugEnabled)
+ msoLogger.debug(" ***** Inside prepareDecomposeService of create generic e2e service ***** ")
String modelInvariantUuid = execution.getVariable("model-invariant-id-original")
String modelVersionId = execution.getVariable("model-version-id-original")
@@ -393,10 +313,11 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
}"""
execution.setVariable("serviceModelInfo", serviceModelInfo)
- utils.log("DEBUG", " ***** Completed prepareDecomposeService of create generic e2e service ***** ", isDebugEnabled)
+ msoLogger.debug(" ***** Completed prepareDecomposeService of create generic e2e service ***** ")
} catch (Exception ex) {
// try error in method block
String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage()
+ msoLogger.error(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
}
@@ -415,23 +336,20 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
private JSONObject getRelatedResourceInAAI (DelegateExecution execution, JSONObject jObj)
{
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO"," ***** Started getRelatedResourceInAAI *****", isDebugEnabled)
+ msoLogger.debug(" ***** Started getRelatedResourceInAAI *****")
-// 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}"
URL url = new URL(serviceAaiPath)
- HttpClient client = new HttpClient(url, "application/xml", TargetEntity.AAI)
+ HttpClient client = new HttpClientFactory().newXmlClient(url, TargetEntity.AAI)
Response response = client.get()
int responseCode = response.getStatus()
execution.setVariable(Prefix + "GeRelatedResourceResponseCode", responseCode)
- utils.log("DEBUG", " Get RelatedResource code is: " + responseCode, isDebugEnabled)
+ msoLogger.debug(" Get RelatedResource code is: " + responseCode)
String aaiResponse = response.readEntity(String.class)
execution.setVariable(Prefix + "GetRelatedResourceResponse", aaiResponse)
@@ -440,7 +358,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
//200 OK 201 CREATED 202 ACCEPTED
{
- utils.log("DEBUG", "GET RelatedResource Received a Good Response", isDebugEnabled)
+ msoLogger.debug("GET RelatedResource Received a Good Response")
execution.setVariable(Prefix + "SuccessIndicator", true)
execution.setVariable(Prefix + "FoundIndicator", true)
@@ -460,20 +378,18 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
jObj.put("modelVersionId", modelUuid)
jObj.put("modelCustomizationId", modelCustomizationId)
}
- else
- {
- utils.log("ERROR", "Get RelatedResource Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled)
- }
-
- utils.log("INFO", " ***** Exit getRelatedResourceInAAI *****", isDebugEnabled)
- return jObj;
+ else {
+ String exceptionMessage = "Get RelatedResource Received a Bad Response Code. Response Code is: " + responseCode
+ msoLogger.error(exceptionMessage)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ msoLogger.debug(" ***** Exit getRelatedResourceInAAI *****")
+ return jObj
}
public void postDecomposeService(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
- utils.log("DEBUG", " ***** Inside processDecomposition() of delete generic e2e service flow ***** ", isDebugEnabled)
+ msoLogger.debug(" ***** Inside processDecomposition() of delete generic e2e service flow ***** ")
try {
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
@@ -527,19 +443,17 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
}
execution.setVariable("isDeleteResourceListValid", isDeleteResourceListValid)
- utils.log("DEBUG", "delete resource list : " + deleteRealResourceList, isDebugEnabled)
+ msoLogger.debug("delete resource list : " + deleteRealResourceList)
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. processDecomposition() - " + ex.getMessage()
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ msoLogger.error(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
utils.log("DEBUG", " ***** exit processDecomposition() of delete generic e2e service flow ***** ", isDebugEnabled)
}
public void preInitResourcesOperStatus(DelegateExecution execution){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
-
- utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
+ msoLogger.debug(" ======== STARTED preInitResourcesOperStatus Process ======== ")
try{
String serviceId = execution.getVariable("serviceInstanceId")
String operationId = execution.getVariable("operationId")
@@ -549,7 +463,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
String progress = "0"
String reason = ""
String operationContent = "Prepare service creation"
- utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled)
+ msoLogger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType)
serviceId = UriUtils.encode(serviceId,"UTF-8")
execution.setVariable("serviceInstanceId", serviceId)
execution.setVariable("operationId", operationId)
@@ -580,19 +494,18 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_initResOperStatusRequest", payload)
- utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)
- utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
+ msoLogger.debug("Outgoing initResourceOperationStatus: \n" + payload)
+ msoLogger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
}catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled)
+ msoLogger.debug("Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e)
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
}
- utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
+ msoLogger.debug("======== COMPLETED preInitResourcesOperStatus Process ======== ")
}
public void prepareUpdateServiceOperationStatus(DelegateExecution execution){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", " ======== STARTED prepareUpdateServiceOperationStatus Process ======== ", isDebugEnabled)
+ msoLogger.debug(" ======== STARTED prepareUpdateServiceOperationStatus Process ======== ")
try{
String serviceId = execution.getVariable("serviceInstanceId")
String operationId = execution.getVariable("operationId")
@@ -606,7 +519,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
- utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
+ msoLogger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
String payload =
"""<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
@@ -628,13 +541,13 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
- utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled)
+ msoLogger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload)
}catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing prepareUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled)
+ msoLogger.error("Exception Occured Processing prepareUpdateServiceOperationStatus. Exception is:\n" + e)
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateServiceOperationStatus Method:\n" + e.getMessage())
}
- utils.log("DEBUG", "======== COMPLETED prepareUpdateServiceOperationStatus Process ======== ", isDebugEnabled)
+ msoLogger.debug("======== COMPLETED prepareUpdateServiceOperationStatus Process ======== ")
}
/**
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
index ca4643dea0..c95704e51a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
@@ -34,6 +34,7 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.AAIResultWrapper
import org.onap.so.client.aai.entities.Relationships
@@ -449,7 +450,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
String vnfAdapterRequest = execution.getVariable(Prefix + "deleteNetworkRequest")
URL url = new URL(vnfAdapterUrl)
- HttpClient httpClient = new HttpClient(url, "application/xml", TargetEntity.OPENSTACK_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.OPENSTACK_ADAPTER)
httpClient.addAdditionalHeader("Authorization", execution.getVariable("BasicAuthHeaderValuePO"))
Response response = httpClient.delete(vnfAdapterRequest)
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 122cc08e89..6a31095920 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
@@ -20,6 +20,8 @@
*/
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
+
import static org.apache.commons.lang3.StringUtils.isBlank
import org.apache.commons.lang3.StringUtils
@@ -65,11 +67,10 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
String Prefix="DDR_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- CatalogDbUtils cutils = new CatalogDbUtils()
+ CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
public void preProcessRequest (DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled)
+ msoLogger.debug(" ***** preProcessRequest *****")
String msg = ""
try {
@@ -79,8 +80,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
//Inputs
//requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology
String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
- if (globalSubscriberId == null)
- {
+ if (globalSubscriberId == null) {
execution.setVariable("globalSubscriberId", "")
}
@@ -95,18 +95,18 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
String serviceInstanceId = execution.getVariable("serviceInstanceId")
if (isBlank(serviceInstanceId)){
msg = "Input serviceInstanceId is null"
- utils.log("INFO", msg, isDebugEnabled)
+ msoLogger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
- String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback')
+ String sdncCallbackUrl = UrnPropertiesReader.getVariable('URN_mso_workflow_sdncadapter_callback', execution)
if (isBlank(sdncCallbackUrl)) {
msg = "URN_mso_workflow_sdncadapter_callback is null"
- utils.log("INFO", msg, isDebugEnabled)
+ msoLogger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
- utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled)
+ msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl)
StringBuilder sbParams = new StringBuilder()
Map<String, String> paramsMap = execution.getVariable("serviceInputParams")
@@ -136,16 +136,14 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- utils.log("INFO", msg, isDebugEnabled)
+ msoLogger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled)
+ msoLogger.debug(" ***** Exit preProcessRequest *****",)
}
public void sequenceResource(DelegateExecution execution){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
-
- utils.log("INFO", " ======== STARTED sequenceResource Process ======== ", isDebugEnabled)
+ msoLogger.debug(" ======== STARTED sequenceResource Process ======== ")
List<Resource> sequencedResourceList = new ArrayList<Resource>()
List<Resource> wanResources = new ArrayList<Resource>()
@@ -198,18 +196,15 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
execution.setVariable("isContainsWanResource", isContainsWanResource)
execution.setVariable("currentResourceIndex", 0)
execution.setVariable("sequencedResourceList", sequencedResourceList)
- utils.log("INFO", "resourceSequence: " + resourceSequence, isDebugEnabled)
- utils.log("INFO", " ======== END sequenceResource Process ======== ", isDebugEnabled)
+ msoLogger.debug("resourceSequence: " + resourceSequence)
+ msoLogger.debug(" ======== END sequenceResource Process ======== ")
}
/**
* prepare delete parameters
*/
public void preResourceDelete(DelegateExecution execution){
-
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
-
- utils.log("INFO", " ======== STARTED preResourceDelete Process ======== ", isDebugEnabled)
+ msoLogger.debug(" ======== STARTED preResourceDelete Process ======== ")
List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
@@ -221,14 +216,14 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
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)
+ msoLogger.debug("Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: "
+ + resourceInstanceUUID + " resourceModelName: " + curResource.getModelInfo().getModelName())
}
else {
execution.setVariable("resourceInstanceId", "")
}
- utils.log("INFO", " ======== END preResourceDelete Process ======== ", isDebugEnabled)
+ msoLogger.debug(" ======== END preResourceDelete Process ======== ")
}
@@ -236,8 +231,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
* Execute delete workflow for resource
*/
public void executeResourceDelete(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", "======== Start executeResourceDelete Process ======== ", isDebugEnabled)
+ msoLogger.debug("======== Start executeResourceDelete Process ======== ")
try {
String requestId = execution.getVariable("msoRequestId")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
@@ -247,7 +241,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
Resource currentResource = execution.getVariable("currentResource")
String action = "deleteInstance"
- JSONObject resourceRecipe = cutils.getResourceRecipe(execution, currentResource.getModelInfo().getModelUuid(), action)
+ JSONObject resourceRecipe = catalogDbUtils.getResourceRecipe(execution, currentResource.getModelInfo().getModelUuid(), action)
String recipeUri = resourceRecipe.getString("orchestrationUri")
int recipeTimeout = resourceRecipe.getInt("recipeTimeout")
String recipeParamXsd = resourceRecipe.get("paramXSD")
@@ -269,20 +263,19 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + recipeUri
HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeout, action, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd)
- utils.log("INFO", " ======== END executeResourceDelete Process ======== ", isDebugEnabled)
+ msoLogger.debug(" ======== END executeResourceDelete Process ======== ")
}catch(BpmnError b){
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ msoLogger.error("Rethrowing MSOWorkflowException")
throw b
}catch(Exception e){
- msoLogger.debug("Error occured within DoDeleteResourcesV1 executeResourceDelete method: " + e)
+ msoLogger.error("Error occured within DoDeleteResourcesV1 executeResourceDelete method: " + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured during DoDeleteResourcesV1 executeResourceDelete Catalog")
}
}
public void parseNextResource(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", "======== Start parseNextResource Process ======== ", isDebugEnabled)
+ msoLogger.debug("======== Start parseNextResource Process ======== ")
def currentIndex = execution.getVariable("currentResourceIndex")
def nextIndex = currentIndex + 1
execution.setVariable("currentResourceIndex", nextIndex)
@@ -292,7 +285,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
}else{
execution.setVariable("allResourceFinished", "false")
}
- utils.log("INFO", "======== COMPLETED parseNextResource Process ======== ", isDebugEnabled)
+ msoLogger.debug("======== COMPLETED parseNextResource Process ======== ")
}
public void prepareFinishedProgressForResource(DelegateExecution execution) {
@@ -340,8 +333,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
}
public void prepareSDNCServiceRequest (DelegateExecution execution, String svcAction) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO"," ***** Started prepareSDNCServiceRequest for " + svcAction + "*****", isDebugEnabled)
+ msoLogger.debug(" ***** Started prepareSDNCServiceRequest for " + svcAction + "*****")
try {
// get variables
@@ -399,16 +391,16 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest)
- utils.logAudit(sndcTopologyDeleteRequesAsString)
+ msoLogger.debug(sndcTopologyDeleteRequesAsString)
execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString)
- utils.log("INFO","sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled)
+ msoLogger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoDeleteResourcesV1 flow. prepareSDNCServiceRequest() - " + ex.getMessage()
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ msoLogger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- utils.log("INFO","***** Exit prepareSDNCServiceRequest for " + svcAction + "*****", isDebugEnabled)
+ msoLogger.debug("***** Exit prepareSDNCServiceRequest for " + svcAction + "*****")
}
}
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 d855479694..6109d8631f 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
@@ -26,12 +26,13 @@ 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.HttpClientFactory
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.utils.TargetEntity
+import org.onap.so.bpmn.core.UrnPropertiesReader
import javax.ws.rs.core.Response
/**
@@ -41,14 +42,10 @@ import javax.ws.rs.core.Response
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()
+ private final HttpClientFactory httpClientFactory = new HttpClientFactory()
/**
* Pre Process the BPMN Flow Request
@@ -83,6 +80,20 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
}"""
execution.setVariable("nsOperationKey", nsOperationKey);
msoLogger.info("nsOperationKey:" + nsOperationKey)
+
+ String vfcAdapterUrl = UrnPropertiesReader.getVariable("mso.adapters.vfc.rest.endpoint", execution)
+
+ if (vfcAdapterUrl == null || vfcAdapterUrl.isEmpty()) {
+ msg = getProcessKey(execution) + ': mso:adapters:vfcc:rest:endpoint URN mapping is not defined'
+ msoLogger.debug(msg)
+ }
+
+ while (vfcAdapterUrl.endsWith('/')) {
+ vfcAdapterUrl = vfcAdapterUrl.substring(0, vfcAdapterUrl.length()-1)
+ }
+
+ execution.setVariable("vfcAdapterUrl", vfcAdapterUrl)
+
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
@@ -123,8 +134,9 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
public void deleteNetworkService(DelegateExecution execution) {
msoLogger.trace("deleteNetworkService start ")
+ String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
- String url = host + vfcUrl + "/ns/" + execution.getVariable("nsInstanceId")
+ String url = vfcAdapterUrl + "/ns/" + execution.getVariable("nsInstanceId")
Response apiResponse = deleteRequest(execution, url, nsOperationKey)
String returnCode = apiResponse.getStatus()
String operationStatus = "error";
@@ -142,8 +154,9 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
public void terminateNetworkService(DelegateExecution execution) {
msoLogger.trace("terminateNetworkService start ")
+ String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey")
- String url = host + vfcUrl + "/ns/" + execution.getVariable("nsInstanceId") + "/terminate"
+ String url = vfcAdapterUrl + "/ns/" + execution.getVariable("nsInstanceId") + "/terminate"
Response apiResponse = postRequest(execution, url, nsOperationKey)
String returnCode = apiResponse.getStatus()
String aaiResponseAsString = apiResponse.readEntity(String.class)
@@ -161,9 +174,10 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
public void queryNSProgress(DelegateExecution execution) {
msoLogger.trace("queryNSProgress start ")
+ String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String jobId = execution.getVariable("jobId")
String nsOperationKey = execution.getVariable("nsOperationKey");
- String url = host + vfcUrl + "/jobs/" + execution.getVariable("jobId")
+ String url = vfcAdapterUrl + "/jobs/" + execution.getVariable("jobId")
Response apiResponse = postRequest(execution, url, nsOperationKey)
String returnCode = apiResponse.getStatus()
String apiResponseAsString = apiResponse.readEntity(String.class)
@@ -206,9 +220,12 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
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")
+ // Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7'
+ // user 'bepl' authHeader is the same with mso.db.auth
+ String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution)
+ HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.VNF_ADAPTER)
+ httpClient.addAdditionalHeader("Accept", "application/json")
+ httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
apiResponse = httpClient.post(requestBody)
@@ -216,7 +233,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
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);
+ msoLogger.error("Exception occured while executing VF-C Post Call. Exception is: \n" + e.getMessage());
throw new BpmnError("MSOWorkflowException")
}
return apiResponse
@@ -234,14 +251,18 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
try{
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")
+ // Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7'
+ // user 'bepl' authHeader is the same with mso.db.auth
+ String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution)
+ HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.VNF_ADAPTER)
+ httpClient.addAdditionalHeader("Accept", "application/json")
+ httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
+
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("Exception occured while executing VF-C Post Call. Exception is: \n" + e.getMessage());
throw new BpmnError("MSOWorkflowException")
}
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 a99f6e993e..19d30bb9b1 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
@@ -29,8 +29,9 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil
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.client.HttpClientFactory
+
import javax.ws.rs.core.Response
import org.onap.so.bpmn.infrastructure.vfcmodel.ScaleResource
@@ -201,7 +202,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess
try{
URL url = new URL(urlString);
- HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER)
httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk")
apiResponse = httpClient.post(requestBody)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy
index cc301db4cd..6dd8085bae 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy
@@ -721,9 +721,9 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
String status = utils.getNodeText(updateNetworkResponse, 'orchestration-status')
if(status.equals("pending-create") || status.equals("PendingCreate")){
- l3Network.setOperationalStatus("Created")
+ l3Network.setOrchestrationStatus("Created")
}else{
- l3Network.setOperationalStatus("Active")
+ l3Network.setOrchestrationStatus("Active")
}
AAIResourcesClient client = new AAIResourcesClient()
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
index f6a8a1558c..06c7002dff 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
@@ -25,11 +25,11 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.GenericVnf
import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.common.scripts.CatalogDbUtils
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.NetworkUtils
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
-import org.onap.so.bpmn.common.scripts.VfModule
import org.onap.so.bpmn.common.scripts.VfModuleBase
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
@@ -38,7 +38,6 @@ import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.AAIResultWrapper
-import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.entities.uri.AAIResourceUri
@@ -46,14 +45,12 @@ import org.onap.so.constants.Defaults
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
-import org.springframework.web.util.UriUtils
-
public class DoUpdateVfModule extends VfModuleBase {
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoUpdateVfModule.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- CatalogDbUtils catalog = new CatalogDbUtils()
+ CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
/**
* Initialize the flow's variables.
@@ -255,7 +252,7 @@ public class DoUpdateVfModule extends VfModuleBase {
String serviceType =""
try{
- String json = catalog.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid )
+ String json = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid )
serviceType = jsonUtil.getJsonValue(json, "serviceResources.serviceType")
}catch(BpmnError e){
throw e
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
index 7fdbb5cb89..9eb05cf64a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
@@ -20,9 +20,8 @@
package org.onap.so.bpmn.infrastructure.scripts
-import static org.apache.commons.lang3.StringUtils.*;
+import org.onap.so.client.HttpClientFactory
-import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -30,21 +29,18 @@ 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.UrnPropertiesReader
import org.onap.so.bpmn.core.domain.ModelInfo
import org.onap.so.bpmn.core.domain.ModuleResource
import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.graphinventory.entities.uri.Depth
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.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.utils.TargetEntity
-import org.springframework.web.util.UriUtils;
/**
* This class supports the VID Flow
@@ -163,7 +159,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
msoLogger.debug("AAI endPoint: " + endPoint)
try {
- HttpClient client = new HttpClient(new URL(endPoint), MediaType.APPLICATION_XML, TargetEntity.AAI)
+ HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), TargetEntity.AAI)
client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString())
client.addAdditionalHeader('X-FromAppId', 'MSO')
client.addAdditionalHeader('Content-Type', 'application/xml')
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
index 1a47ef88e2..a8e3b2040b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
@@ -24,7 +24,6 @@ import static org.apache.commons.lang3.StringUtils.*
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.CatalogDbUtils
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.VidUtils
@@ -55,7 +54,6 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
VidUtils vidUtils = new VidUtils()
- CatalogDbUtils catalogDbUtils = new CatalogDbUtils()
/**
* This method is executed during the preProcessRequest task of the <class>CreateServiceInstance.bpmn</class> process.
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
index 7a6fd72a7d..7a40ef978b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
@@ -21,13 +21,10 @@ package org.onap.so.bpmn.vcpe.scripts
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.so.bpmn.common.scripts.AbstractServiceTaskProcessor
-import org.onap.so.bpmn.common.scripts.CatalogDbUtils
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.NetworkUtils
import org.onap.so.bpmn.common.scripts.VidUtils
-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.logger.MessageEnum
@@ -40,10 +37,6 @@ 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 javax.ws.rs.NotFoundException
-import org.json.JSONObject
-
-import static org.apache.commons.lang3.StringUtils.isBlank
-
/**
* This groovy class supports the <class>DeleteVcpeResCustService.bpmn</class> process.
@@ -60,7 +53,6 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
VidUtils vidUtils = new VidUtils()
- CatalogDbUtils catalogDbUtils = new CatalogDbUtils()
NetworkUtils networkUtils = new NetworkUtils()
/**
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java
index 209cbac98a..2268d22bd2 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright 2018 Nokia
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -21,6 +23,7 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
@@ -32,15 +35,16 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
- * Implementation of "Create AAI entry with pnf-id = correlation_id" task in CreateAndActivatePnfResource.bpmn
+ * Implementation of "Create Pnf entry in AAI" task in CreateAndActivatePnfResource.bpmn
*
* Inputs:
* - correlationId - String
+ * - pnfUuid - String
*/
@Component
-public class CreateAaiEntryWithPnfIdDelegate implements JavaDelegate {
+public class CreatePnfEntryInAaiDelegate implements JavaDelegate {
- private static final Logger logger = LoggerFactory.getLogger(CreateAaiEntryWithPnfIdDelegate.class);
+ private static final Logger logger = LoggerFactory.getLogger(CreatePnfEntryInAaiDelegate.class);
private AaiConnection aaiConnection;
@Autowired
@@ -51,11 +55,11 @@ public class CreateAaiEntryWithPnfIdDelegate implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) throws Exception {
String correlationId = (String) execution.getVariable(CORRELATION_ID);
+ String pnfUuid = (String) execution.getVariable(PNF_UUID);
Pnf pnf = new Pnf();
- pnf.setInMaint(true);
- pnf.setPnfId(correlationId);
+ pnf.setPnfId(pnfUuid);
pnf.setPnfName(correlationId);
aaiConnection.createEntry(correlationId, pnf);
- logger.debug("AAI entry is created for pnf correlation id: {}", correlationId);
+ logger.debug("AAI entry is created for pnf correlation id: {}, pnf uuid: {}", correlationId, pnfUuid);
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java
index b3f2f726a0..1407cb9211 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright 2018 Nokia
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -30,4 +32,5 @@ public class ExecutionVariableNames {
public final static String AAI_CONTAINS_INFO_ABOUT_IP = "aaiContainsInfoAboutIp";
public final static String DMAAP_MESSAGE = "dmaapMessage";
public final static String TIMEOUT_FOR_NOTIFICATION = "timeoutForPnfEntryNotification";
+ public final static String PNF_UUID = "pnfUuid";
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java
new file mode 100644
index 0000000000..f5483e489e
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Nokia.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
+
+import java.util.UUID;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class GeneratePnfUuidDelegate implements JavaDelegate {
+
+ private static final Logger logger = LoggerFactory.getLogger(GeneratePnfUuidDelegate.class);
+
+ @Override
+ public void execute(DelegateExecution delegateExecution){
+ UUID uuid = UUID.randomUUID();
+ logger.debug("Generated UUID for pnf: {}, version: {}, variant: {}", uuid, uuid.version(), uuid.variant());
+ delegateExecution.setVariable(PNF_UUID, uuid.toString());
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
index 94fb6a8674..e9b0bc77b2 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright 2018 Nokia
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -21,9 +23,11 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION;
import com.google.common.base.Strings;
+import java.util.regex.Pattern;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.bpmn.common.scripts.ExceptionUtil;
@@ -35,6 +39,8 @@ import org.springframework.stereotype.Component;
@Component
public class PnfCheckInputs implements JavaDelegate {
+ private static final Pattern UUID_PATTERN = Pattern
+ .compile("(?i)^[0-9a-f]{8}-[0-9a-f]{4}-[1-5]{1}[0-9a-f]{3}-[89ab]{1}[0-9a-f]{3}-[0-9a-f]{12}$");
private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, PnfCheckInputs.class);
private String defaultTimeout;
@@ -46,19 +52,37 @@ public class PnfCheckInputs implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) {
+ validateCorrelationId(execution);
+ validatePnfUuid(execution);
+ validateTimeout(execution);
+ }
+
+ private void validateCorrelationId(DelegateExecution execution) {
String correlationId = (String) execution.getVariable(CORRELATION_ID);
if (Strings.isNullOrEmpty(correlationId)) {
new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "correlationId variable not defined");
}
+ }
+
+ private void validatePnfUuid(DelegateExecution execution) {
+ String pnfUuid = (String) execution.getVariable(PNF_UUID);
+ if (Strings.isNullOrEmpty(pnfUuid)) {
+ new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "pnfUuid variable not defined");
+ }
+ if (!UUID_PATTERN.matcher(pnfUuid).matches()) {
+ new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "pnfUuid is not a valid UUID");
+ }
+ }
+
+ private void validateTimeout(DelegateExecution execution) {
String timeout = (String) execution.getVariable(TIMEOUT_FOR_NOTIFICATION);
if (Strings.isNullOrEmpty(timeout)) {
LOGGER.debug("timeoutForPnfEntryNotification variable not found, setting default");
if (defaultTimeout == null) {
new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999,
- "default timeoutForPnfEntryNotification value not defined");
+ "default timeoutForPnfEntryNotification value not defined");
}
execution.setVariable(TIMEOUT_FOR_NOTIFICATION, defaultTimeout);
}
}
-
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
index f29044456c..52f879b0ad 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
@@ -117,6 +117,9 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
} catch (IOException e) {
logger.error("Exception caught during sending rest request to dmaap for listening event topic", e);
}
+ finally {
+ getRequest.reset();
+ }
}
private List<String> getCorrelationIdListFromResponse(HttpResponse response) throws IOException {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
index 7f1c2fd9b1..ac341886ba 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
@@ -622,7 +622,9 @@ public class ServicePluginFactory {
// in demo we have only one VPN. no cross VPNs, so get first item.
Map<String, Object> returnRoute = getReturnRoute(returnList);
Map<String, Object> vpnRequestInputs = getVPNResourceRequestInputs(resources);
- vpnRequestInputs.putAll(returnRoute);
+ if(null!=vpnRequestInputs) {
+ vpnRequestInputs.putAll(returnRoute);
+ }
String newRequest = getJsonString(uuiObject);
return newRequest;
}