diff options
7 files changed, 83 insertions, 82 deletions
diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml index 20a3566181..88bfa6c651 100644 --- a/asdc-controller/pom.xml +++ b/asdc-controller/pom.xml @@ -87,22 +87,7 @@ <dependency> <groupId>org.onap.sdc.sdc-tosca</groupId> <artifactId>sdc-tosca</artifactId> - <version>1.3.3</version> - <!-- sdc-tosca:1.3.3 depends on jtosca:1.3.4-SNAPSHOT, - which must be excluded, and the release version - of jtosca must be pulled in using an additional - dependency, below --> - <exclusions> - <exclusion> - <groupId>org.onap.sdc.jtosca</groupId> - <artifactId>jtosca</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.onap.sdc.jtosca</groupId> - <artifactId>jtosca</artifactId> - <version>1.3.4</version> + <version>1.3.0</version> </dependency> <dependency> diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index 32e7d4a6ac..1d255c4eb4 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -353,22 +353,7 @@ <dependency> <groupId>org.onap.sdc.sdc-tosca</groupId> <artifactId>sdc-tosca</artifactId> - <version>1.3.3</version> - <!-- sdc-tosca:1.3.3 depends on jtosca:1.3.4-SNAPSHOT, - which must be excluded, and the release version - of jtosca must be pulled in using an additional - dependency, below --> - <exclusions> - <exclusion> - <groupId>org.onap.sdc.jtosca</groupId> - <artifactId>jtosca</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.onap.sdc.jtosca</groupId> - <artifactId>jtosca</artifactId> - <version>1.3.4</version> + <version>1.3.0</version> </dependency> <dependency> <groupId>org.camunda.bpm</groupId> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy index b29c4dc101..9456007dc8 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy @@ -70,13 +70,13 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { //deal with nsName and Description
String resourceInput = execution.getVariable("resourceInput")
+ String resourceParameters = jsonUtil.getJsonValue(resourceInput, "resourceParameters")
// get service name
String resourceName = jsonUtil.getJsonValue(resourceInput, "resourceInstanceName")
- String nsServiceName = resourceName.substring(resourceName.indexOf("_") + 1)
- execution.setVariable("nsServiceName", nsServiceName)
+ execution.setVariable("nsServiceName", resourceName)
String nsServiceDescription = execution.getVariable("nsServiceDescription")
- utils.log("INFO", "nsServiceName:" + nsServiceName + " nsServiceDescription:" + nsServiceDescription, isDebugEnabled)
+ utils.log("INFO", "nsServiceName:" + resourceName + " nsServiceDescription:" + nsServiceDescription, isDebugEnabled)
//deal with operation key
String globalSubscriberId = jsonUtil.getJsonValue(resourceInput, "globalSubscriberId")
utils.log("INFO", "globalSubscriberId:" + globalSubscriberId, isDebugEnabled)
@@ -90,7 +90,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { String operationId = execution.getVariable("requestId")
utils.log("INFO", "serviceType:" + serviceType, isDebugEnabled)
- String nodeTemplateUUID = jsonUtil.getJsonValue(resourceInput, "resourceModelInfo.modelCustomizationUuid")
+ String nodeTemplateUUID = jsonUtil.getJsonValue(resourceParameters, "requestInputs.nsd0_providing_service_uuid")
utils.log("INFO", "nodeTemplateUUID:" + nodeTemplateUUID, isDebugEnabled)
/*
* segmentInformation needed as a object of segment
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy index 38dca886b4..690738b312 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy @@ -32,6 +32,8 @@ import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.core.domain.ModelInfo +import org.openecomp.mso.bpmn.core.domain.NetworkResource import org.openecomp.mso.bpmn.core.domain.Resource import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition import org.openecomp.mso.bpmn.core.domain.ServiceInstance @@ -144,42 +146,28 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO", " ======== STARTED sequenceResource Process ======== ", isDebugEnabled) - List<String> nsResources = new ArrayList<String>() + List<Resource> sequencedResourceList = new ArrayList<Resource>() List<String> wanResources = new ArrayList<String>() - List<String> resourceSequence = new ArrayList<String>() // get delete resource list and order list List<Resource> delResourceList = execution.getVariable("deleteResourceList") // existing resource list List<ServiceInstance> existResourceList = execution.getVariable("realNSRessources") - for(ServiceInstance rc_e : existResourceList){ + def resourceSequence = BPMNProperties.getResourceSequenceProp() - String muuid = rc_e.getModelInfo().getModelUuid() - String mIuuid = rc_e.getModelInfo().getModelInvariantUuid() - String mCuuid = rc_e.getModelInfo().getModelCustomizationUuid() - rcType = rc_e.getInstanceName() + for (resourceType in resourceSequence.reverse()) { + for (resource in delResourceList) { + if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) { + sequencedResourceList.add(resource) - for(Resource rc_d : delResourceList){ - - if(rc_d.getModelInfo().getModelUuid() == muuid - && rc_d.getModelInfo().getModelInvariantUuid() == mIuuid - && rc_d.getModelInfo().getModelCustomizationUuid() == mCuuid) { - - if(StringUtils.containsIgnoreCase(rcType, "overlay") - || StringUtils.containsIgnoreCase(rcType, "underlay")){ - wanResources.add(rcType) - }else{ - nsResources.add(rcType) + if (resource instanceof NetworkResource) { + wanResources.add(resource) } - } } - } - resourceSequence.addAll(wanResources) - resourceSequence.addAll(nsResources) String isContainsWanResource = wanResources.isEmpty() ? "false" : "true" execution.setVariable("isContainsWanResource", isContainsWanResource) execution.setVariable("currentResourceIndex", 0) @@ -198,21 +186,19 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { utils.log("INFO", " ======== STARTED preResourceDelete Process ======== ", isDebugEnabled) - List<ServiceInstance> existResourceList = execution.getVariable("realNSRessources") - - for(ServiceInstance rc_e : existResourceList){ + List<Resource> existResourceList = execution.getVariable("deleteResourceList") - if(StringUtils.containsIgnoreCase(rc_e.getInstanceName(), resourceName)) { + int currentIndex = execution.getVariable("currentResourceIndex") + Resource curResource = existResourceList.get(currentIndex); - String resourceInstanceUUID = rc_e.getInstanceId() - String resourceTemplateUUID = rc_e.getModelInfo().getModelUuid() - execution.setVariable("resourceInstanceId", resourceInstanceUUID) - execution.setVariable("resourceTemplateId", resourceTemplateUUID) - execution.setVariable("resourceType", resourceName) - utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " - + resourceInstanceUUID + " resourceType: " + resourceName, isDebugEnabled) - } - } + String resourceInstanceUUID = curResource.getResourceId() + String resourceTemplateUUID = curResource.getModelInfo().getModelUuid() + execution.setVariable("resourceInstanceId", resourceInstanceUUID) + execution.setVariable("resourceUuid", resourceTemplateUUID) + execution.setVariable("resourceType", curResource.getModelInfo().getModelName()) + execution.setVariable("currentResource", curResource) + utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + + resourceInstanceUUID + " resourceType: " + resourceName, isDebugEnabled) utils.log("INFO", " ======== END preResourceDelete Process ======== ", isDebugEnabled) } @@ -221,19 +207,38 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { /** * Execute delete workflow for resource */ - public void executeResourceDelete(execution) { + public void executeResourceDelete(execution, resourceName) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO", "======== Start executeResourceDelete Process ======== ", isDebugEnabled) String requestId = execution.getVariable("msoRequestId") String serviceInstanceId = execution.getVariable("serviceInstanceId") String serviceType = execution.getVariable("serviceType") - ResourceInput resourceInput = execution.getVariable("resourceInput") - String requestAction = resourceInput.getOperationType() - JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceUuid(), requestAction) + + String resourceInstanceId = execution.getVariable("resourceInstanceId") + String resourceUuid = execution.getVariable("resourceUuid") + + String requestAction = execution.getVariable("operationType") + JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceUuid, requestAction) String recipeUri = resourceRecipe.getString("orchestrationUri") - String recipeTimeOut = resourceRecipe.getString("recipeTimeout") + int recipeTimeout = resourceRecipe.getInt("recipeTimeout") String recipeParamXsd = resourceRecipe.get("paramXSD") - HttpResponse resp = BpmnRestClient.post(recipeUri, requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) + + Resource currentResource = execution.getVariable("currentResource") + + ResourceInput resourceInput = new ResourceInput(); + resourceInput.setServiceInstanceId(serviceInstanceId) + resourceInput.setResourceInstanceName(currentResource.getResourceInstanceName()) + resourceInput.setGlobalSubscriberId("globalSubscriberId") + ModelInfo modelInfo = new ModelInfo() + modelInfo.setModelCustomizationUuid(currentResource.getModelInfo().getModelCustomizationUuid()) + modelInfo.setModelUuid(currentResource.getModelInfo().getModelCustomizationUuid()) + modelInfo.setModelInvariantUuid(currentResource.getModelInfo().getModelInvariantUuid()) + resourceInput.setServiceModelInfo(modelInfo) + resourceInput.setServiceType(serviceType) + + String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + recipeUri + + HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) utils.log("INFO", " ======== END executeResourceDelete Process ======== ", isDebugEnabled) } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn index c730c8e2de..a9e3f5d807 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn @@ -33,14 +33,14 @@ ex.processJavaException(execution)]]></bpmn:script> </bpmn:subProcess> <bpmn:sequenceFlow id="SequenceFlow_1twf9nk" sourceRef="Task_1t687g1" targetRef="Task_0i59nr9" /> <bpmn:sequenceFlow id="SequenceFlow_1ba6i0r" sourceRef="Task_1cglzlg" targetRef="EndEvent_1x6k78c" /> - <bpmn:scriptTask id="Task_1t687g1" name="Pre Resource Delete"> + <bpmn:scriptTask id="Task_1t687g1" name="Pre Resource Delete" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_01medil</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1twf9nk</bpmn:outgoing> <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* def dsdncr = new DeleteSDNCNetworkResource() -dsdncr.preProcessSDNCDelete(execution)]]></bpmn:script> +dsdncr.preProcessRequest(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="Task_1cglzlg" name="Post Resource Delete"> + <bpmn:scriptTask id="Task_1cglzlg" name="Post Resource Delete" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_092fygq</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1ba6i0r</bpmn:outgoing> <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* @@ -48,7 +48,7 @@ def dsdncr = new DeleteSDNCNetworkResource() dsdncr.postProcessSDNCDelete(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_01medil" sourceRef="Task_1d5rrfs" targetRef="Task_1t687g1" /> - <bpmn:scriptTask id="Task_1d5rrfs" name="Set RecipeParam"> + <bpmn:scriptTask id="Task_1d5rrfs" name="Set RecipeParam" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> <bpmn:outgoing>SequenceFlow_01medil</bpmn:outgoing> <bpmn:script><![CDATA[String recipeParamXsdDemo=""" diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn index ac8e60778b..20686252bd 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn @@ -164,6 +164,7 @@ dcsi.postDecomposeService(execution)]]></bpmn:script> <camunda:in source="serviceInputParams" target="serviceInputParams" /> <camunda:in source="deleteResourceList" target="deleteResourceList" /> <camunda:in source="resourceInstanceIDs" target="resourceInstanceIDs" /> + <camunda:in source="operationType" target="operationType" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1j08ko3</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1cevtpy</bpmn:outgoing> diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java index 3fa074e8e1..27c94f0770 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java @@ -94,6 +94,7 @@ public class CatalogDatabase implements Closeable { private static final String MODEL_VERSION_ID = "modelVersionId"; private static final String MODEL_CUSTOMIZATION_UUID = "modelCustomizationUuid"; private static final String VF_MODULE_MODEL_UUID = "vfModuleModelUUId"; + private static final String NETWORK_SERVICE = "network service"; protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL); @@ -1202,7 +1203,7 @@ public class CatalogDatabase implements Closeable { /** * Return a Network recipe that matches a given MODEL_UUID and ACTION * - * @param modelName + * @param vnfModelUuid * @param action * @return NetworkRecipe object or null if none found */ @@ -1217,9 +1218,33 @@ public class CatalogDatabase implements Closeable { } VnfRecipe recipe = this.getVnfRecipeByNameVersion(vnfResource.getModelName(), vnfResource.getVersion(), action); + + if (recipe == null && vnfResource.getSubCategory().equalsIgnoreCase(NETWORK_SERVICE)) { + recipe = getDefaultVnfRecipe(action); + } return recipe; } + private VnfRecipe getDefaultVnfRecipe(String action) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get default VNF recipe with action: " + action); + + Query query = getSession().createQuery("FROM VnfRecipe WHERE vnfType = :vnfType AND action = :action "); + query.setParameter(VNF_TYPE, "NS_DEFAULT"); + query.setParameter(ACTION, action); + + @SuppressWarnings("unchecked") + List <VnfRecipe> resultList = query.list(); + + if (resultList.isEmpty()) { + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", "getVnfRecipe", null); + return null; + } + + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfRecipe", null); + return resultList.get(0); + } + /** * Return a VNF recipe that matches a given VF_MODULE_ID and ACTION * |