diff options
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common')
6 files changed, 82 insertions, 24 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy index 238ac82c01..b30929d6bd 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy @@ -503,7 +503,9 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess resourceTemplateUUIDs = resourceTemplateUUIDs + it.resourceInstanceId + ":" } } - execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) + execution.setVariable("URN_mso_adapters_openecomp_db_endpoint", dbAdapterEndpoint) String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy index 5bc1e65024..59ea5c236f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy @@ -916,8 +916,6 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) - execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") - String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://org.onap.so/requestsdb"> @@ -984,7 +982,8 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce } } } - def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" + + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index 3630df00f4..a981abf011 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -30,18 +30,19 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray import org.json.JSONObject -import org.onap.so.bpmn.common.scripts.AaiUtil + import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.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.springframework.web.util.UriUtils; +import org.springframework.web.util.UriUtils import org.w3c.dom.Document import org.w3c.dom.Element import org.w3c.dom.Node @@ -417,8 +418,9 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** Started getRelatedResourceInAAI *****", isDebugEnabled) - AaiUtil aaiUriUtil = new AaiUtil() - String aai_endpoint = execution.getVariable("URN_aai_endpoint") +// 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}" @@ -518,6 +520,12 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { // only delete real existing resources execution.setVariable("deleteResourceList", deleteRealResourceList) + + boolean isDeleteResourceListValid = false + if(deleteRealResourceList.size() > 0) { + isDeleteResourceListValid = true + } + execution.setVariable("isDeleteResourceListValid", isDeleteResourceListValid) utils.log("DEBUG", "delete resource list : " + deleteRealResourceList, isDebugEnabled) } catch (Exception ex) { @@ -553,8 +561,8 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" } - - execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) + execution.setVariable("URN_mso_adapters_openecomp_db_endpoint", dbAdapterEndpoint) String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" @@ -581,6 +589,53 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) } + + public void prepareUpdateServiceOperationStatus(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " ======== STARTED prepareUpdateServiceOperationStatus Process ======== ", isDebugEnabled) + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String userId = "" + String result = execution.getVariable("result") + String progress = execution.getVariable("progress") + String reason = "" + String operationContent = execution.getVariable("operationContent") + + serviceId = UriUtils.encode(serviceId,"UTF-8") + + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + + String payload = + """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:updateServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb"> + <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId> + <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> + <operationType>DELETE</operationType> + <userId>${MsoUtils.xmlEscape(userId)}</userId> + <result>${MsoUtils.xmlEscape(result)}</result> + <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent> + <progress>${MsoUtils.xmlEscape(progress)}</progress> + <reason>${MsoUtils.xmlEscape(reason)}</reason> + </ns:updateServiceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) + utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing prepareUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateServiceOperationStatus Method:\n" + e.getMessage()) + } + utils.log("DEBUG", "======== COMPLETED prepareUpdateServiceOperationStatus Process ======== ", isDebugEnabled) + } /** * post config request. diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy index 9accbd8d24..122cc08e89 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy @@ -214,14 +214,19 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") int currentIndex = execution.getVariable("currentResourceIndex") - Resource curResource = sequencedResourceList.get(currentIndex); - - String resourceInstanceUUID = curResource.getResourceId() - String resourceTemplateUUID = curResource.getModelInfo().getModelUuid() - execution.setVariable("resourceInstanceId", resourceInstanceUUID) - execution.setVariable("currentResource", curResource) - utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " - + resourceInstanceUUID + " resourceModelName: " + curResource.getModelInfo().getModelName(), isDebugEnabled) + if(sequencedResourceList != null && sequencedResourceList.size() > currentIndex){ + Resource curResource = sequencedResourceList.get(currentIndex); + + String resourceInstanceUUID = curResource.getResourceId() + String resourceTemplateUUID = curResource.getModelInfo().getModelUuid() + execution.setVariable("resourceInstanceId", resourceInstanceUUID) + execution.setVariable("currentResource", curResource) + utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + + resourceInstanceUUID + " resourceModelName: " + curResource.getModelInfo().getModelName(), isDebugEnabled) + } + else { + execution.setVariable("resourceInstanceId", "") + } utils.log("INFO", " ======== END preResourceDelete Process ======== ", isDebugEnabled) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy index 58ee260c25..baa695af09 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy @@ -169,7 +169,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" } - def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy index df0cd4618d..4127c3a913 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy @@ -153,8 +153,6 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor execution.setVariable("operationType", "update") execution.setVariable("hasResourcetoUpdate", false) - execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") - } catch (BpmnError e) { throw e; } catch (Exception ex){ @@ -309,11 +307,10 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor execution.setVariable("operationId", operationId) execution.setVariable("operationType", operationType) - def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) - execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://org.onap.so/requestsdb"> |