diff options
Diffstat (limited to 'bpmn')
168 files changed, 4023 insertions, 855 deletions
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index abf53f96f5..b115d36a0a 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -363,12 +363,12 @@ <dependency> <groupId>org.onap.sdc.sdc-tosca</groupId> <artifactId>sdc-tosca</artifactId> - <version>1.4.1</version> + <version>1.4.4</version> </dependency> <dependency> <groupId>org.onap.sdc.jtosca</groupId> <artifactId>jtosca</artifactId> - <version>1.4.1</version> + <version>1.4.4</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy index 2f240fb70d..4f0b530a3b 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy @@ -931,7 +931,8 @@ class MsoUtils { if (moduleIndexList == null || moduleIndexList.size() == 0) { return "0" } - def sortedModuleIndexList = moduleIndexList.sort { a, b -> a.compareTo b } + + def sortedModuleIndexList = moduleIndexList.sort{ a, b -> a as Integer <=> b as Integer} for (i in 0..sortedModuleIndexList.size()-1) { if (Integer.parseInt(sortedModuleIndexList[i]) != i) { diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy index 5659c7affa..5e949fd8d2 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy @@ -35,7 +35,7 @@ import org.onap.so.client.HttpClientFactory import org.onap.so.logger.MsoLogger import org.onap.so.db.catalog.beans.CloudIdentity import org.onap.so.db.catalog.beans.CloudSite - +import org.onap.so.db.catalog.beans.HomingInstance import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.utils.TargetEntity @@ -209,17 +209,12 @@ class OofHoming extends AbstractServiceTaskProcessor { for (int j = 0; j < arrSol.length(); j++) { JSONObject placement = arrSol.getJSONObject(j) utils.log("DEBUG", "****** Placement Solution is: " + placement + " *****", "true") - String jsonServiceResourceId = placement.getString("serviceResourceId") - String jsonResourceModuleName = placement.getString("resourceModuleName") + String jsonServiceResourceId = jsonUtil.getJsonValue( placement.toString(), "serviceResourceId") + utils.log("DEBUG", "****** homing serviceResourceId is: " + jsonServiceResourceId + " *****", "true") for (Resource resource : resourceList) { String serviceResourceId = resource.getResourceId() - String resourceModuleName = "" - if (resource.getResourceType() == ResourceType.ALLOTTED_RESOURCE || - resource.getResourceType() == ResourceType.VNF) { - resourceModuleName = resource.getNfFunction() - } - if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId) || - resourceModuleName.equalsIgnoreCase(jsonResourceModuleName)) { + utils.log("DEBUG", "****** decomp serviceResourceId is: " + serviceResourceId + " *****", "true") + if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) { JSONObject solution = placement.getJSONObject("solution") String solutionType = solution.getString("identifierType") String inventoryType = "" @@ -228,20 +223,26 @@ class OofHoming extends AbstractServiceTaskProcessor { } else { inventoryType = "cloud" } + utils.log("DEBUG", "****** homing inventoryType is: " + inventoryType + " *****", "true") resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType)) JSONArray assignmentArr = placement.getJSONArray("assignmentInfo") + utils.log("DEBUG", "****** assignmentInfo is: " + assignmentArr.toString() + " *****", "true") + + Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, + assignmentArr.toString(), "key", "value") String oofDirectives = null - assignmentArr.each { element -> - JSONObject jsonObject = new JSONObject(element.toString()) - if (jsonUtil.getJsonRawValue(jsonObject.toString(), "key") == "oof_directives") { - oofDirectives = jsonUtil.getJsonRawValue(jsonObject.toString(), "value") + assignmentMap.each { key, value -> + utils.log("DEBUG", "****** element: " + key + " *****", "true") + if (key == "oof_directives") { + oofDirectives = value + utils.log("DEBUG", "****** homing oofDirectives: " + oofDirectives + " *****", "true") } } - Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, - assignmentArr.toString(), "key", "value") String cloudOwner = assignmentMap.get("cloudOwner") + utils.log("DEBUG", "****** homing cloudOwner: " + cloudOwner + " *****", "true") String cloudRegionId = assignmentMap.get("locationId") + utils.log("DEBUG", "****** homing cloudRegionId: " + cloudRegionId + " *****", "true") resource.getHomingSolution().setCloudOwner(cloudOwner) resource.getHomingSolution().setCloudRegionId(cloudRegionId) @@ -249,12 +250,26 @@ class OofHoming extends AbstractServiceTaskProcessor { cloudSite.setId(cloudRegionId) cloudSite.setRegionId(cloudRegionId) String orchestrator = execution.getVariable("orchestrator") - if ((orchestrator != null) || (orchestrator != "")) { + if ((orchestrator != null) && (orchestrator != "")) { cloudSite.setOrchestrator(orchestrator) + utils.log("DEBUG", "****** orchestrator: " + orchestrator + " *****", "true") + } else { + cloudSite.setOrchestrator("multicloud") } CloudIdentity cloudIdentity = new CloudIdentity() cloudIdentity.setId(cloudRegionId) + cloudIdentity.setIdentityServerType(ServerType."KEYSTONE") + cloudIdentity.setAdminTenant("service") + cloudIdentity.setIdentityAuthenticationType(AuthenticationType.USERNAME_PASSWORD) + String msoMulticloudUserName = UrnPropertiesReader + .getVariable("mso.multicloud.api.username", execution, + "apih") + String msoMulticloudPassword = UrnPropertiesReader + .getVariable("mso.multicloud.api.password", execution, + "abc123") + cloudIdentity.setMsoId(msoMulticloudUserName) + cloudIdentity.setMsoPass(msoMulticloudPassword) // Get MSB Url String msbHost = oofUtils.getMsbHost(execution) String multicloudApiEndpoint = UrnPropertiesReader @@ -263,19 +278,39 @@ class OofHoming extends AbstractServiceTaskProcessor { cloudIdentity.setIdentityUrl(msbHost + multicloudApiEndpoint + "/" + cloudOwner + "/" + cloudRegionId + "/infra_workload") - + utils.log("DEBUG", "****** Cloud IdentityUrl: " + msbHost + multicloudApiEndpoint + + "/" + cloudOwner + "/" + + cloudRegionId + "/infra_workload" + + " *****", "true") + utils.log("DEBUG", "****** CloudIdentity: " + cloudIdentity.toString() + + " *****", "true") cloudSite.setIdentityService(cloudIdentity) + utils.log("DEBUG", "****** CloudSite: " + cloudSite.toString() + + " *****", "true") // Set cloudsite in catalog DB here - oofUtils.createCloudSiteCatalogDb(cloudSite) + oofUtils.createCloudSite(cloudSite, execution) if (oofDirectives != null && oofDirectives != "") { resource.getHomingSolution().setOofDirectives(oofDirectives) execution.setVariable("oofDirectives", oofDirectives) - utils.log("DEBUG", "***** OofDirectives is: " + oofDirectives + + utils.log("DEBUG", "***** OofDirectives set to: " + oofDirectives + " *****", "true") } + // Set Homing Instance + String serviceInstanceId = decomposition.getServiceInstance().getInstanceId() + HomingInstance homingInstance = new HomingInstance() + homingInstance.setServiceInstanceId(serviceInstanceId) + homingInstance.setCloudOwner(cloudOwner) + homingInstance.setCloudRegionId(cloudRegionId) + if (oofDirectives != null && oofDirectives != "") { + homingInstance.setOofDirectives(oofDirectives)} + else { + homingInstance.setOofDirectives("{}") + } + oofUtils.createHomingInstance(homingInstance, execution) + if (inventoryType.equalsIgnoreCase("service")) { resource.getHomingSolution().setRehome(assignmentMap.get("isRehome").toBoolean()) VnfResource vnf = new VnfResource() @@ -283,6 +318,12 @@ class OofHoming extends AbstractServiceTaskProcessor { resource.getHomingSolution().setVnf(vnf) resource.getHomingSolution().setServiceInstanceId(solution.getJSONArray("identifiers")[0].toString()) } + } else { + utils.log("DEBUG", "ProcessHomingSolution Exception: no matching serviceResourceIds returned in " + + "homing solution", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - " + + "Occurred in Homing ProcessHomingSolution: no matching serviceResourceIds returned") + } } } @@ -312,8 +353,10 @@ class OofHoming extends AbstractServiceTaskProcessor { utils.log("DEBUG", "*** Completed Homing Process Homing Solution ***", isDebugEnabled) } catch (BpmnError b) { + utils.log("DEBUG", "ProcessHomingSolution Error: " + b, isDebugEnabled) throw b } catch (Exception e) { + utils.log("DEBUG", "ProcessHomingSolution Exception: " + e, isDebugEnabled) msoLogger.error(e); exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in Homing ProcessHomingSolution") } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy index c0da8881fb..af33f38a64 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -36,6 +36,7 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory import org.onap.so.db.catalog.beans.CloudSite +import org.onap.so.db.catalog.beans.HomingInstance import org.onap.so.utils.TargetEntity import org.springframework.http.HttpEntity import org.springframework.http.HttpHeaders @@ -495,6 +496,7 @@ class OofUtils { if (candidatesJson != "") {candidatesJson = candidatesJson.substring(0, candidatesJson.length() - 1)} return candidatesJson } + /** * This method creates a cloudsite in catalog database. * @@ -524,9 +526,19 @@ class OofUtils { exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from CatalogDB.") } } - + + /** + * This method creates a HomingInstance in catalog database. + * + * @param HomingInstance homingInstance + * + * @return void + */ + Void createHomingInstance(HomingInstance homingInstance, DelegateExecution execution) { + oofInfraUtils.createHomingInstance(homingInstance, execution) + } String getMsbHost(DelegateExecution execution) { - msbHost = UrnPropertiesReader.getVariable("mso.msb.host", execution, "msb-iag.onap") + String msbHost = UrnPropertiesReader.getVariable("mso.msb.host", execution, "msb-iag.onap") Integer msbPort = UrnPropertiesReader.getVariable("mso.msb.port", execution, "80").toInteger() diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java index 12a4b2a9c3..025b533dc0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java @@ -20,29 +20,18 @@ package org.onap.so.bpmn.common.resource; -import java.io.File; import java.io.IOException; -import java.nio.file.Paths; +import java.lang.reflect.Type; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.Optional; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; import org.camunda.bpm.engine.runtime.Execution; -import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; -import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException; -import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory; -import org.onap.sdc.toscaparser.api.NodeTemplate; -import org.onap.sdc.toscaparser.api.Property; -import org.onap.sdc.toscaparser.api.RequirementAssignment; -import org.onap.sdc.toscaparser.api.RequirementAssignments; -import org.onap.sdc.toscaparser.api.functions.GetInput; -import org.onap.sdc.toscaparser.api.parameters.Input; import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.client.HttpClient; @@ -58,86 +47,34 @@ import com.google.gson.reflect.TypeToken; public class ResourceRequestBuilder { - private static String CUSTOMIZATION_UUID = "customizationUUID"; + private static String CUSTOMIZATION_UUID = "cuserviceResourcesstomizationUUID"; - private static String SERVICE_URL_TOSCA_CSAR = "/v3/serviceToscaCsar"; + private static String SERVICE_URL_SERVICE_INSTANCE = "/v2/serviceResources"; private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ResourceRequestBuilder.class); static JsonUtils jsonUtil = new JsonUtils(); - public static List<String> getResourceSequence(Execution execution, String serviceUuid) { - List<String> resouceSequence = new ArrayList<String>(); - List<NodeTemplate> resultList = new ArrayList<NodeTemplate>(); - String csarpath = null; - try { - csarpath = getCsarFromUuid(serviceUuid); - - SdcToscaParserFactory toscaParser = SdcToscaParserFactory.getInstance(); - ISdcCsarHelper iSdcCsarHelper = toscaParser.getSdcCsarHelper(csarpath, false); - List<NodeTemplate> nodeTemplates = iSdcCsarHelper.getServiceNodeTemplates(); - List<NodeTemplate> nodes = new ArrayList<NodeTemplate>(); - nodes.addAll(nodeTemplates); - - for (NodeTemplate nodeTemplate : nodeTemplates) { - RequirementAssignments requirement = iSdcCsarHelper.getRequirementsOf(nodeTemplate); - - if (requirement == null || requirement.getAll() == null || requirement.getAll().isEmpty()) { - resultList.add(nodeTemplate); - nodes.remove(nodeTemplate); - } - } - - resultList = getRequirementList(resultList, nodes, iSdcCsarHelper); - - for (NodeTemplate node : resultList) { - String templateName = node.getMetaData().getValue("name"); - if (!resouceSequence.contains(templateName)) { - resouceSequence.add(templateName); - } - } - - } catch (SdcToscaParserException toscarParserE) { - LOGGER.debug("sdc tosca parser failed for csar: " + csarpath, toscarParserE); - return resouceSequence; - } catch (Exception e) { - LOGGER.debug("csar file is not available for service uuid:" + serviceUuid, e); - return resouceSequence; - } - - return resouceSequence; - } + public static List<String> getResourceSequence(String serviceUuid) { + + List<String> resourceSequence = new ArrayList(); + try { + Map<String, Object> serviceResponse = getServiceInstnace(serviceUuid); + + if (serviceResponse.containsKey("serviceResources")) { + Map<String, Object> serviceResources = (Map<String, Object>) serviceResponse.get("serviceResources"); - private static List<NodeTemplate> getRequirementList(List<NodeTemplate> resultList, List<NodeTemplate> nodeTemplates, - ISdcCsarHelper iSdcCsarHelper) { - - List<NodeTemplate> nodes = new ArrayList<NodeTemplate>(); - nodes.addAll(nodeTemplates); - - for (NodeTemplate nodeTemplate : nodeTemplates) { - RequirementAssignments requirement = iSdcCsarHelper.getRequirementsOf(nodeTemplate); - List<RequirementAssignment> reqAs = requirement.getAll(); - for (RequirementAssignment ra : reqAs) { - String reqNode = ra.getNodeTemplateName(); - for (NodeTemplate rNode : resultList) { - if (rNode.getName().equals(reqNode)) { - if(!resultList.contains(nodeTemplate)) { - resultList.add(nodeTemplate); - } - if(nodes.contains(nodeTemplate)) { - nodes.remove(nodeTemplate); - } - break; - } - } - } - } - - if (!nodes.isEmpty()) { - getRequirementList(resultList, nodes, iSdcCsarHelper); - } - - return resultList; + if (serviceResources.containsKey("resourceOrder")) { + String resourceOrder = (String) serviceResources.get("resourceOrder"); + if (resourceOrder!= null) { + resourceSequence.addAll(Arrays.asList(resourceOrder.split(","))); + } + } + } + } catch (Exception e) { + LOGGER.error("not able to retrieve service order."); + } + return resourceSequence; } /* build the resource Parameters detail. @@ -184,12 +121,8 @@ public class ResourceRequestBuilder { resourceInputsFromUuiMap = new HashMap(); } - try { - Map<String, Object> resourceInputsFromServiceDeclaredLevel = buildResouceRequest(serviceUuid, resourceCustomizationUuid, serviceInput); - resourceInputsFromUuiMap.putAll(resourceInputsFromServiceDeclaredLevel); - } catch(SdcToscaParserException e) { - LOGGER.error("SdcToscaParserException", e); - } + Map<String, Object> resourceInputsFromServiceDeclaredLevel = buildResouceRequest(serviceUuid, resourceCustomizationUuid, serviceInput); + resourceInputsFromUuiMap.putAll(resourceInputsFromServiceDeclaredLevel); String resourceInputsStr = getJsonString(resourceInputsFromUuiMap); String result = "{\n" + "\"locationConstraints\":" + locationConstraints +",\n" @@ -198,91 +131,95 @@ public class ResourceRequestBuilder { return result; } - public static Map<String, Object> buildResouceRequest(String serviceUuid, String resourceCustomizationUuid, Map<String, Object> serviceInputs) - throws SdcToscaParserException { - - Map<String, Object> resouceRequest = new HashMap<>(); - - String csarpath = null; + @SuppressWarnings("unchecked") + public static Map<String, Object> buildResouceRequest(String serviceUuid, String resourceCustomizationUuid, Map<String, Object> serviceInputs) { try { - csarpath = getCsarFromUuid(serviceUuid); - } catch(Exception e) { - LOGGER.debug("csar file is not available for service uuid:" + serviceUuid, e); - return resouceRequest; - } + Map<String, Object> serviceInstnace = getServiceInstnace(serviceUuid); - SdcToscaParserFactory toscaParser = SdcToscaParserFactory.getInstance(); - ISdcCsarHelper iSdcCsarHelper = toscaParser.getSdcCsarHelper(csarpath, false); + // find match of customization uuid in vnf + Map<String, Map<String, Object>> serviceResources = (Map<String, Map<String, Object>>) serviceInstnace.get("serviceResources"); - List<Input> serInput = iSdcCsarHelper.getServiceInputs(); - Optional<NodeTemplate> nodeTemplateOpt = iSdcCsarHelper.getServiceNodeTemplates().stream() - .filter(e -> e.getMetaData().getValue(CUSTOMIZATION_UUID).equals(resourceCustomizationUuid)).findFirst(); + List<Map<String, Object>> serviceVnfCust = (List<Map<String, Object>>) serviceResources.get("serviceVnfs"); + String resourceInputStr = getResourceInputStr(serviceVnfCust, resourceCustomizationUuid); - if(nodeTemplateOpt.isPresent()) { - NodeTemplate nodeTemplate = nodeTemplateOpt.get(); - LinkedHashMap<String, Property> resourceProperties = nodeTemplate.getProperties(); + // find match in network resource + if (resourceInputStr == null) { + List<Map<String, Object>> serviceNetworkCust = (List<Map<String, Object>>) serviceResources.get("serviceNetworks"); + resourceInputStr = getResourceInputStr(serviceNetworkCust, resourceCustomizationUuid); - for(String key : resourceProperties.keySet()) { - Property property = resourceProperties.get(key); - - Object value = getValue(property.getValue(), serviceInputs, serInput); - resouceRequest.put(key, value); + // find match in AR resource + if (resourceInputStr == null) { + List<Map<String, Object>> serviceArCust = (List<Map<String, Object>>) serviceResources.get("serviceAllottedResources"); + resourceInputStr = getResourceInputStr(serviceArCust, resourceCustomizationUuid); + } } + + if (resourceInputStr != null || !resourceInputStr.equals("")) { + return getResourceInput(resourceInputStr, serviceInputs); + } + + } catch (Exception e) { + LOGGER.error("not able to retrieve service instance"); } - return resouceRequest; + return new HashMap(); } - private static Object getValue(Object value, Map<String, Object> serviceInputs, List<Input> servInputs) { - if(value instanceof Map) { - Map<String, Object> valueMap = new HashMap<>(); + private static String getResourceInputStr(List<Map<String, Object>> resources, String resCustomizationUuid) { - Map<String, Object> propertyMap = (Map<String, Object>)value; + for (Map<String, Object> resource : resources) { + Map<String, String> modelInfo = (Map<String, String>) resource.get("modelInfo"); - for(String key : propertyMap.keySet()) { - valueMap.put(key, getValue(propertyMap.get(key), serviceInputs, servInputs)); + if (modelInfo.get("modelCustomizationUuid").equalsIgnoreCase(resCustomizationUuid)) { + return (String) resource.get("resourceInput"); } - return valueMap; // return if the value is nested hashmap - } else if(value instanceof GetInput) { - String inputName = ((GetInput)value).getInputName(); - - if(serviceInputs.get(inputName) != null) { - value = serviceInputs.get(inputName); - } else { - for(Input input : servInputs) { - if(input.getName().equals(inputName)) { - return input.getDefault(); // return default value - } + } + return null; + } + + // this method combines resource input with service input + private static Map<String, Object> getResourceInput(String resourceInputStr, Map<String, Object> serviceInputs) { + Gson gson = new Gson(); + Type type = new TypeToken<Map<String, String>>(){}.getType(); + Map<String, Object> resourceInput = gson.fromJson(resourceInputStr, type); + + // replace value if key is available in service input + for (String key: resourceInput.keySet()) { + String value = (String) resourceInput.get(key); + + if (value.contains("|")) { + // node it type of getinput + String[] split = value.split("\\|"); + String tmpKey = split[0]; + if (serviceInputs.containsKey(tmpKey)) { + value = (String) serviceInputs.get(tmpKey); + } else { + value = split[1]; } } + resourceInput.put(key,value); } - return value; // return property value + return resourceInput; } - private static String getCsarFromUuid(String uuid) throws Exception { - String catalogEndPoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint"); - HttpClient client = new HttpClientFactory().newJsonClient( - UriBuilder.fromUri(catalogEndPoint).path(SERVICE_URL_TOSCA_CSAR).queryParam("serviceModelUuid", uuid).build().toURL(), - TargetEntity.CATALOG_DB); - - client.addAdditionalHeader("Accept", "application/json"); -// client.addBasicAuthHeader (UrnPropertiesReader.getVariable("mso.adapters.db.auth"), UrnPropertiesReader.getVariable("mso.msoKey")); - client.addAdditionalHeader("Authorization", UrnPropertiesReader.getVariable("mso.db.auth")); - Response response = client.get(); - String value = response.readEntity(String.class); + public static Map<String, Object> getServiceInstnace(String uuid) throws Exception { + String catalogEndPoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint"); - HashMap<String, String> map = new Gson().fromJson(value, new TypeToken<HashMap<String, String>>() {}.getType()); + HttpClient client = new HttpClientFactory().newJsonClient( + UriBuilder.fromUri(catalogEndPoint).path(SERVICE_URL_SERVICE_INSTANCE).queryParam("serviceModelUuid", uuid).build().toURL(), + TargetEntity.CATALOG_DB); - String filePath = Paths.get(System.getProperty("mso.config.path"), "ASDC", map.get("version"), map.get("name")).normalize().toString(); + client.addAdditionalHeader("Accept", "application/json"); + client.addAdditionalHeader("Authorization", UrnPropertiesReader.getVariable("mso.db.auth")); - File csarFile = new File(filePath); + Response apiResponse = client.get(); - if(!csarFile.exists()) { - throw new Exception("csar file does not exist in filePath:" + csarFile.getAbsolutePath()); - } + String value = apiResponse.readEntity(String.class); - return csarFile.getAbsolutePath(); + ObjectMapper objectMapper = new ObjectMapper(); + HashMap<String, Object> map = objectMapper.readValue(value, HashMap.class); + return map; } - + public static <T> T getJsonObject(String jsonstr, Class<T> type) { ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java new file mode 100644 index 0000000000..df7b57f3a3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java @@ -0,0 +1,112 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018. Intel Corp. All rights reserved. + * ================================================================================ + * 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.common.util; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.db.catalog.beans.HomingInstance; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Arrays; +import java.util.Optional; + +public class OofInfraUtils { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, OofInfraUtils.class); + + /** + * This method creates a cloudsite in catalog database. + * + * @param cloudSite + * + * @return void + */ + public void createCloudSite(CloudSite cloudSite, DelegateExecution execution) { + String endpoint = UrnPropertiesReader.getVariable("mso.catalog.db.spring.endpoint", execution); + String auth = UrnPropertiesReader.getVariable("mso.db.auth", execution); + try { + CloudSite getCloudsite; + + CatalogDbClient client = new CatalogDbClient(endpoint, auth); + + getCloudsite = Optional.ofNullable(client.getCloudSite(cloudSite.getId(), endpoint + "/cloudSite/")).orElse(new CloudSite()); + if (!cloudSite.getId().equals(getCloudsite.getId())) { + client.postCloudSite(cloudSite); + LOGGER.debug("Did not findd cloudsite : " + cloudSite.getId()); + LOGGER.debug("Will create cloudSite: " + cloudSite.toString()); + } + else { + LOGGER.debug("Found cloudsite : " + cloudSite.getId()); + LOGGER.debug("Will not create cloudSite: " + cloudSite.toString()); + } + } catch (Exception e) { + LOGGER.debug("Error looking up or creating cloudsite : " + cloudSite.getId()); + LOGGER.debug("CloudSite Lookup/Creation Error: " + e); + } + + + } + + /** + * This method creates a HomingInstance in catalog database. + * + * @param homingInstance + * + * @return void + */ + public void createHomingInstance(HomingInstance homingInstance, DelegateExecution execution) { + String endpoint = UrnPropertiesReader.getVariable("mso.catalog.db.spring.endpoint", execution); + String auth = UrnPropertiesReader.getVariable("mso.db.auth", execution); + + CatalogDbClient client = new CatalogDbClient(endpoint, auth); + try { + client.postHomingInstance(homingInstance); + } catch (Exception exception) { + LOGGER.debug("Could not create HomingInstance : " + homingInstance.getServiceInstanceId()); + LOGGER.debug("HomingInstance Creation Error: " + exception); + } + + } + + /** + * This method gets a HomingInstance in catalog database. + * + * @param serviceInstanceId + * + * @return HomingInstance + */ + public HomingInstance getHomingInstance(String serviceInstanceId, DelegateExecution execution) { + String endpoint = UrnPropertiesReader.getVariable("mso.catalog.db.spring.endpoint", execution); + String auth = UrnPropertiesReader.getVariable("mso.db.auth", execution); + + CatalogDbClient client = new CatalogDbClient(endpoint, auth); + try { + return client.getHomingInstance(serviceInstanceId, endpoint + "/homingInstance/"); + } catch (Exception exception) { + LOGGER.debug("Could not get HomingInstance for serviceInstanceId : " + serviceInstanceId); + LOGGER.debug("Get HomingInstance Error: " + exception); + } + return null; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java index 91cd2ad791..a727162415 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java @@ -31,10 +31,10 @@ public class Candidate implements Serializable { private static final long serialVersionUID = -3959572501582849328L; - @JsonProperty("candidateType") - private CandidateType candidateType; - @JsonProperty("candidates") - private List<String> candidates; + @JsonProperty("identifierType") + private CandidateType identifierType; + @JsonProperty("identifiers") + private List<String> identifiers; @JsonProperty("cloudOwner") private String cloudOwner; @@ -42,32 +42,32 @@ public class Candidate implements Serializable { * list of candidates * i.e. actual serviceInstanceId, actual vnfName, actual cloudRegionId, etc. */ - public List<String> getCandidates() { - return candidates; + public List<String> getIdentifiers() { + return identifiers; } /** * list of candidates * i.e. actual serviceInstanceId, actual vnfName, actual cloudRegionId, etc. */ - public void setCandidates(List<String> candidates) { - this.candidates = candidates; + public void setIdentifiers(List<String> identifiers) { + this.identifiers = identifiers; } /** * Way to identify the type of candidate * i.e. "serviceInstanceId", "vnfName", "cloudRegionId", etc. */ - public CandidateType getCandidateType(){ - return candidateType; + public CandidateType getIdentifierType(){ + return identifierType; } /** * Way to identify the type of candidate * i.e. "serviceInstanceId", "vnfName", "cloudRegionId", etc. */ - public void setCandidateType(CandidateType candidateType){ - this.candidateType = candidateType; + public void setIdentifierType(CandidateType identifierType){ + this.identifierType = identifierType; } /** diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index 63f832d706..fbff0620a3 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -107,6 +107,7 @@ public class BBInputSetup implements JavaDelegate { private static final String NETWORK = "Network"; private static final String VNF = "Vnf"; private static final String NETWORK_COLLECTION = "NetworkCollection"; + private static final String PREPROV = "PREPROV"; @Autowired private BBInputSetupUtils bbInputSetupUtils; @@ -273,10 +274,11 @@ public class BBInputSetup implements JavaDelegate { throws Exception { ModelInfo modelInfo = requestDetails.getModelInfo(); String instanceName = requestDetails.getRequestInfo().getInstanceName(); + String productFamilyId = requestDetails.getRequestInfo().getProductFamilyId(); ModelType modelType = modelInfo.getModelType(); RelatedInstanceList[] relatedInstanceList = requestDetails.getRelatedInstanceList(); - org.onap.so.serviceinstancebeans.Platform platform = requestDetails.getPlatform(); + org.onap.so.serviceinstancebeans.Platform platform = requestDetails.getPlatform(); org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = requestDetails.getLineOfBusiness(); if (modelType.equals(ModelType.network)) { @@ -285,7 +287,7 @@ public class BBInputSetup implements JavaDelegate { } else if (modelType.equals(ModelType.vnf)) { lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, resourceId); this.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, - lookupKeyMap, relatedInstanceList, resourceId, vnfType, null); + lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, productFamilyId); } else if (modelType.equals(ModelType.volumeGroup)) { lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, resourceId); this.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, @@ -404,17 +406,16 @@ public class BBInputSetup implements JavaDelegate { if (lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null && vfModuleTemp.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) { vfModule = vfModuleTemp; - String vfModuleCustId = bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()).getModelCustomizationId(); - modelInfo.setModelCustomizationId(vfModuleCustId); - break; } + String vfModuleCustId = bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModuleTemp.getVfModuleId()).getModelCustomizationId(); + ModelInfo modelInfoVfModule = new ModelInfo(); + modelInfoVfModule.setModelCustomizationId(vfModuleCustId); + mapCatalogVfModule(vfModuleTemp, modelInfoVfModule, service, vnfModelCustomizationUUID); } if (vfModule == null && bbName.equalsIgnoreCase(AssignFlows.VF_MODULE.toString())) { vfModule = createVfModule(lookupKeyMap, resourceId, instanceName, instanceParams); vnf.getVfModules().add(vfModule); - } - if(vfModule != null) { mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); } } else { @@ -579,7 +580,8 @@ public class BBInputSetup implements JavaDelegate { org.onap.so.serviceinstancebeans.Platform platform, org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness, Service service, String bbName, ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, - RelatedInstanceList[] relatedInstanceList, String resourceId, String vnfType, List<Map<String, String>> instanceParams) { + RelatedInstanceList[] relatedInstanceList, String resourceId, String vnfType, List<Map<String, String>> instanceParams, + String productFamilyId) { GenericVnf vnf = null; ModelInfo instanceGroupModelInfo = null; String instanceGroupId = null; @@ -607,7 +609,7 @@ public class BBInputSetup implements JavaDelegate { } if (vnf == null && bbName.equalsIgnoreCase(AssignFlows.VNF.toString())) { vnf = createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, - resourceId, generatedVnfType, instanceParams); + resourceId, generatedVnfType, instanceParams, productFamilyId); serviceInstance.getVnfs().add(vnf); mapVnfcCollectionInstanceGroup(vnf, modelInfo, service); } @@ -658,13 +660,16 @@ public class BBInputSetup implements JavaDelegate { protected GenericVnf createGenericVnf(Map<ResourceKey, String> lookupKeyMap, String instanceName, org.onap.so.serviceinstancebeans.Platform platform, - org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness, String vnfId, String vnfType, List<Map<String, String>> instanceParams) { + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness, String vnfId, String vnfType, List<Map<String, String>> instanceParams, + String productFamilyId) { lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfId); GenericVnf genericVnf = new GenericVnf(); genericVnf.setVnfId(vnfId); genericVnf.setVnfName(instanceName); genericVnf.setOrchestrationStatus(OrchestrationStatus.PRECREATED); genericVnf.setVnfType(vnfType); + genericVnf.setProvStatus(PREPROV); + genericVnf.setServiceId(productFamilyId); if (platform != null) { genericVnf.setPlatform(this.mapperLayer.mapRequestPlatform(platform)); } @@ -1169,8 +1174,10 @@ public class BBInputSetup implements JavaDelegate { if (request != null) { this.bbInputSetupUtils.updateInfraActiveRequestVnfId(request, vnfId); } + String productFamilyId = requestDetails.getRequestInfo().getProductFamilyId(); this.populateGenericVnf(vnfs.getModelInfo(), vnfs.getInstanceName(), vnfs.getPlatform(), - vnfs.getLineOfBusiness(), service, bbName, serviceInstance, lookupKeyMap, null, vnfId, vnfType, vnfs.getInstanceParams()); + vnfs.getLineOfBusiness(), service, bbName, serviceInstance, lookupKeyMap, null, vnfId, vnfType, vnfs.getInstanceParams(), + productFamilyId); } else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP)) { Pair<Vnfs, VfModules> vnfsAndVfModules = getVfModulesAndItsVnfsByKey(key, resources); vfModules = vnfsAndVfModules.getValue1(); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java index d2e0b07dd1..ee7999f995 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java @@ -40,20 +40,22 @@ import org.springframework.stereotype.Component; @Component public class ExecuteBuildingBlockRainyDay { - - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExecuteBuildingBlockRainyDay.class); + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, + ExecuteBuildingBlockRainyDay.class); public static final String HANDLING_CODE = "handlingCode"; - + @Autowired private CatalogDbClient catalogDbClient; @Autowired private RequestsDbClient requestDbclient; private static final String ASTERISK = "*"; - + @Autowired - private Environment environment; + private Environment environment; protected String retryDurationPath = "mso.rainyDay.retryDurationMultiplier"; protected String defaultCode = "mso.rainyDay.defaultCode"; + protected String maxRetries = "mso.rainyDay.maxRetries"; public void setRetryTimer(DelegateExecution execution) { try { @@ -67,7 +69,7 @@ public class ExecuteBuildingBlockRainyDay { throw new BpmnError("Unknown error incrementing retry counter"); } } - + public void queryRainyDayTable(DelegateExecution execution, boolean primaryPolicy) { try { ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock"); @@ -79,18 +81,20 @@ public class ExecuteBuildingBlockRainyDay { boolean aLaCarte = (boolean) execution.getVariable("aLaCarte"); boolean suppressRollback = (boolean) execution.getVariable("suppressRollback"); String handlingCode = ""; - if(suppressRollback){ + if (suppressRollback) { handlingCode = "Abort"; - }else{ + } else { try { - serviceType = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0).getModelInfoServiceInstance().getServiceType(); + serviceType = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0) + .getModelInfoServiceInstance().getServiceType(); } catch (Exception ex) { // keep default serviceType value } String vnfType = ASTERISK; try { - for(GenericVnf vnf : gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0).getVnfs()) { - if(vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + for (GenericVnf vnf : gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0) + .getVnfs()) { + if (vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { vnfType = vnf.getVnfType(); } } @@ -104,58 +108,85 @@ public class ExecuteBuildingBlockRainyDay { } catch (Exception ex) { // keep default errorCode value } + try { + errorCode = "" + (String) execution.getVariable("WorkflowExceptionCode"); + } catch (Exception ex) { + // keep default errorCode value + } + String workStep = ASTERISK; try { workStep = workflowException.getWorkStep(); } catch (Exception ex) { // keep default workStep value } - //Extract error data to be returned to WorkflowAction - execution.setVariable("WorkflowExceptionErrorMessage", workflowException.getErrorMessage()); + + try { + // Extract error data to be returned to WorkflowAction + execution.setVariable("WorkflowExceptionErrorMessage", workflowException.getErrorMessage()); + } catch (Exception e) { + msoLogger.error("No WorkflowException Found",e); + } RainyDayHandlerStatus rainyDayHandlerStatus; - rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,serviceType,vnfType,errorCode,workStep); - if(rainyDayHandlerStatus==null){ - rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,ASTERISK,ASTERISK,ASTERISK,ASTERISK); - if(rainyDayHandlerStatus==null){ + rainyDayHandlerStatus = catalogDbClient + .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName, + serviceType, vnfType, errorCode, workStep); + if (rainyDayHandlerStatus == null) { + rainyDayHandlerStatus = catalogDbClient + .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName, + ASTERISK, ASTERISK, errorCode, ASTERISK); + } + + if (rainyDayHandlerStatus == null) { + rainyDayHandlerStatus = catalogDbClient + .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName, + ASTERISK, ASTERISK, ASTERISK, ASTERISK); + if (rainyDayHandlerStatus == null) { handlingCode = "Abort"; - }else{ - if(primaryPolicy){ + } else { + if (primaryPolicy) { handlingCode = rainyDayHandlerStatus.getPolicy(); - }else{ + } else { handlingCode = rainyDayHandlerStatus.getSecondaryPolicy(); } } - }else{ - if(primaryPolicy){ + } else { + if (primaryPolicy) { handlingCode = rainyDayHandlerStatus.getPolicy(); - }else{ + } else { handlingCode = rainyDayHandlerStatus.getSecondaryPolicy(); } } - if(!primaryPolicy){ - try{ + if (!primaryPolicy) { + try { InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); request.setRetryStatusMessage("Retries have been exhausted."); requestDbclient.updateInfraActiveRequests(request); - } catch(Exception ex){ - msoLogger.debug(ex.toString()); - msoLogger.error("Failed to update Request Db Infra Active Requests with Retry Status"); + } catch (Exception ex) { + msoLogger.error("Failed to update Request Db Infra Active Requests with Retry Status",ex); } } - if(handlingCode.equals("RollbackToAssigned")&&!aLaCarte){ + if (handlingCode.equals("RollbackToAssigned") && !aLaCarte) { handlingCode = "Rollback"; } } msoLogger.debug("RainyDayHandler Status Code is: " + handlingCode); execution.setVariable(HANDLING_CODE, handlingCode); } catch (Exception e) { - msoLogger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = Abort"); String code = this.environment.getProperty(defaultCode); + msoLogger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = "+ code, e); execution.setVariable(HANDLING_CODE, code); } + try{ + int envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries)); + execution.setVariable("maxRetries", envMaxRetries); + } catch (Exception ex) { + msoLogger.error("Could not read maxRetries from config file. Setting max to 5 retries"); + execution.setVariable("maxRetries", 5); + } } - - public void setHandlingStatusSuccess(DelegateExecution execution){ + + public void setHandlingStatusSuccess(DelegateExecution execution) { execution.setVariable(HANDLING_CODE, "Success"); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index 42da72528f..459ef66e5b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -61,6 +61,34 @@ public class ExceptionBuilder { msg = msg.concat(exception.getMessage()); buildAndThrowWorkflowException(execution, errorCode, msg); } + + public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, Exception exception) { + String msg = "Exception in %s.%s "; + try{ + msoLogger.error(exception); + + String errorVariable = "Error%s%s"; + + StackTraceElement[] trace = Thread.currentThread().getStackTrace(); + for (StackTraceElement traceElement : trace) { + if (!traceElement.getClassName().equals(this.getClass().getName()) && !traceElement.getClassName().equals(Thread.class.getName())) { + msg = String.format(msg, traceElement.getClassName(), traceElement.getMethodName()); + String shortClassName = traceElement.getClassName().substring(traceElement.getClassName().lastIndexOf(".") + 1); + errorVariable = String.format(errorVariable, shortClassName, traceElement.getMethodName()); + break; + } + } + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, msg.toString()); + execution.setVariable(errorVariable, exception.getMessage()); + } catch (Exception ex){ + //log trace, allow process to complete gracefully + msoLogger.error(ex); + } + + if (exception.getMessage() != null) + msg = msg.concat(exception.getMessage()); + buildAndThrowWorkflowException(execution, errorCode, msg); + } public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, String errorMessage) { if (execution instanceof DelegateExecutionImpl) { @@ -74,10 +102,16 @@ public class ExceptionBuilder { WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage); execution.setVariable("WorkflowException", exception); + execution.setVariable("WorkflowExceptionErrorMessage", errorMessage); msoLogger.info("Outgoing WorkflowException is " + exception); msoLogger.info("Throwing MSOWorkflowException"); throw new BpmnError("MSOWorkflowException"); } + + public void buildAndThrowWorkflowException(DelegateExecution execution, String errorCode, String errorMessage) { + execution.setVariable("WorkflowExceptionErrorMessage", errorMessage); + throw new BpmnError(errorCode,errorMessage); + } public String getProcessKey(DelegateExecution execution) { String testKey = (String) execution.getVariable("testProcessKey"); diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy index 3da126f7a9..97db9775c9 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy @@ -34,9 +34,9 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory import javax.ws.rs.core.UriBuilder import static org.junit.Assert.assertEquals import static org.junit.Assert.assertTrue -import static org.mockito.Matchers.any -import static org.mockito.Matchers.anyObject -import static org.mockito.Matchers.isA +import static org.mockito.ArgumentMatchers.any +import static org.mockito.ArgumentMatchers.anyObject +import static org.mockito.ArgumentMatchers.isA import static org.mockito.Mockito.atLeastOnce import static org.mockito.Mockito.doNothing import static org.mockito.Mockito.doThrow diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcessTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcessTest.groovy index 70068c849b..99c351c465 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcessTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcessTest.groovy @@ -33,7 +33,7 @@ import org.onap.so.bpmn.core.WorkflowException import static org.assertj.core.api.Assertions.assertThat import static org.assertj.core.api.Assertions.assertThatThrownBy -import static org.mockito.Matchers.eq +import static org.mockito.ArgumentMatchers.eq import static org.mockito.Mockito.* @RunWith(MockitoJUnitRunner.class) diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy index 55f68f665e..dac038fab3 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy @@ -97,7 +97,7 @@ class CreateAAIVfModuleTest extends MsoGroovyTest{ @Test void testCreateGenericVnf(){ when(mockExecution.getVariable("CAAIVfMod_vnfName")).thenReturn("vnfName") - Mockito.doNothing().when(client).create(any(AAIResourceUri.class),anyObject()) + Mockito.doNothing().when(client).create(any(AAIResourceUri.class) as AAIResourceUri,anyObject()) createAAIVfModule.createGenericVnf(mockExecution) Mockito.verify(mockExecution).setVariable("CAAIVfMod_createGenericVnfResponseCode", 201) Mockito.verify(mockExecution).setVariable("CAAIVfMod_createGenericVnfResponse","Vnf Created") @@ -112,7 +112,7 @@ class CreateAAIVfModuleTest extends MsoGroovyTest{ when(mockExecution.getVariable("CAAIVfMod_personaId")).thenReturn("model1") when(mockExecution.getVariable("CAAIVfMod_moduleName")).thenReturn("vfModuleName") - Mockito.doNothing().when(client).create(any(AAIResourceUri.class),anyObject()) + Mockito.doNothing().when(client).create(any(AAIResourceUri.class) as AAIResourceUri,anyObject()) createAAIVfModule.createVfModule(mockExecution,false) Mockito.verify(mockExecution).setVariable("CAAIVfMod_createVfModuleResponseCode", 201) Mockito.verify(mockExecution).setVariable("CAAIVfMod_createVfModuleResponse","Vf Module Created") @@ -173,7 +173,7 @@ class CreateAAIVfModuleTest extends MsoGroovyTest{ Optional<GenericVnf> genericVnf = getAAIObjectFromJson(GenericVnf.class,"__files/aai/GenericVnfVfModule.json"); when(mockExecution.getVariable("CAAIVfMod_queryGenericVnfResponse")).thenReturn(genericVnf.get()) when(mockExecution.getVariable("CAAIVfMod_moduleName")).thenReturn("vfModuleName") - Mockito.doNothing().when(client).create(any(AAIResourceUri.class),anyObject()) + Mockito.doNothing().when(client).create(any(AAIResourceUri.class) as AAIResourceUri,anyObject()) createAAIVfModule.createVfModule(mockExecution,true) Mockito.verify(mockExecution).setVariable("CAAIVfMod_createVfModuleResponseCode", 201) Mockito.verify(mockExecution).setVariable("CAAIVfMod_createVfModuleResponse","Vf Module Created") diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy index 4b6f8aa918..2a872511e7 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy @@ -92,7 +92,7 @@ class DeleteAAIVfModuleTest extends MsoGroovyTest{ void testDeleteGenericVnf() { ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable("DAAIVfMod_vnfId")).thenReturn("vnfId1") - doNothing().when(client).delete(isA(AAIResourceUri.class)) + doNothing().when(client).delete(isA(AAIResourceUri.class) as AAIResourceUri) deleteAAIVfModule.deleteGenericVnf(mockExecution) Mockito.verify(mockExecution).setVariable(prefix + "deleteGenericVnfResponseCode", 200) } @@ -169,7 +169,7 @@ class DeleteAAIVfModuleTest extends MsoGroovyTest{ ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable("DAAIVfMod_vnfId")).thenReturn("vnfId1") try { - doThrow(new NotFoundException("Vnf Not Found")).when(client).delete(isA(AAIResourceUri.class)) + doThrow(new NotFoundException("Vnf Not Found")).when(client).delete(isA(AAIResourceUri.class) as AAIResourceUri) deleteAAIVfModule.deleteGenericVnf(mockExecution) } catch (Exception ex) { println " Test End - Handle catch-throw BpmnError()! " @@ -186,7 +186,7 @@ class DeleteAAIVfModuleTest extends MsoGroovyTest{ ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable("DAAIVfMod_vnfId")).thenReturn("vnfId1") when(mockExecution.getVariable("DAAIVfMod_vfModuleId")).thenReturn("vfModuleId1") - doNothing().when(client).delete(isA(AAIResourceUri.class)) + doNothing().when(client).delete(isA(AAIResourceUri.class) as AAIResourceUri) deleteAAIVfModule.deleteVfModule(mockExecution) Mockito.verify(mockExecution).setVariable(prefix + "deleteVfModuleResponseCode", 200) } @@ -197,7 +197,7 @@ class DeleteAAIVfModuleTest extends MsoGroovyTest{ when(mockExecution.getVariable("DAAIVfMod_vnfId")).thenReturn("vnfId1") when(mockExecution.getVariable("DAAIVfMod_vfModuleId")).thenReturn("vfModuleId1") try { - doThrow(new NotFoundException("Vnf Not Found")).when(client).delete(isA(AAIResourceUri.class)) + doThrow(new NotFoundException("Vnf Not Found")).when(client).delete(isA(AAIResourceUri.class) as AAIResourceUri) deleteAAIVfModule.deleteVfModule(mockExecution) } catch (Exception ex) { println " Test End - Handle catch-throw BpmnError()! " diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoUtilsTest.groovy index dfaf5d2140..c6a68c0e7a 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoUtilsTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoUtilsTest.groovy @@ -277,5 +277,13 @@ class MsoUtilsTest { } } - + @Test + public void testGetLowestUnusedIndex() { + def responseAsString = getFile("vfModuleCount.xml") + def index = utils.getLowestUnusedIndex(responseAsString) + println " lowest module count test: " + println " actual - " + index + println " expected - " + "14" + assertEquals("expected vs actual", "14", index) + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy index 5641c5e12f..2bd5181c31 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy @@ -40,8 +40,8 @@ import org.onap.so.bpmn.mock.FileUtil import org.onap.so.bpmn.mock.StubResponseAAI import static com.github.tomakehurst.wiremock.client.WireMock.* -import static org.mockito.Matchers.any -import static org.mockito.Matchers.refEq +import static org.mockito.ArgumentMatchers.any +import static org.mockito.ArgumentMatchers.refEq import static org.mockito.Mockito.* @RunWith(MockitoJUnitRunner.class) diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy index 2d2f58b415..72bcfcf359 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy @@ -111,7 +111,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest { vfModule.setVfModuleId("supercool") vfModule.setResourceVersion("12345") when(mockExecution.getVariable(prefix + "getVfModuleResponse")).thenReturn(vfModule) - doNothing().when(client).update(isA(AAIResourceUri.class), anyObject()) + doNothing().when(client).update(isA(AAIResourceUri.class) as AAIResourceUri, anyObject()) updateAAIVfModule.updateVfModule(mockExecution) verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 200) } @@ -126,7 +126,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest { vfModule.setVfModuleId("supercool") vfModule.setResourceVersion("12345") when(mockExecution.getVariable(prefix + "getVfModuleResponse")).thenReturn(vfModule) - doThrow(new NotFoundException("Vf Module not found")).when(client).update(isA(AAIResourceUri.class), anyObject()) + doThrow(new NotFoundException("Vf Module not found")).when(client).update(isA(AAIResourceUri.class) as AAIResourceUri, anyObject()) thrown.expect(BpmnError.class) updateAAIVfModule.updateVfModule(mockExecution) verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 404) @@ -143,7 +143,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest { vfModule.setVfModuleId("supercool") vfModule.setResourceVersion("12345") when(mockExecution.getVariable(prefix + "getVfModuleResponse")).thenReturn(vfModule) - doThrow(new IllegalStateException("Error in AAI client")).when(client).update(isA(AAIResourceUri.class), anyObject()) + doThrow(new IllegalStateException("Error in AAI client")).when(client).update(isA(AAIResourceUri.class) as AAIResourceUri, anyObject()) thrown.expect(BpmnError.class) updateAAIVfModule.updateVfModule(mockExecution) verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 500) diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/DelegateExecutionImplTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/DelegateExecutionImplTest.java index cf74356fa2..32a18d5a7a 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/DelegateExecutionImplTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/DelegateExecutionImplTest.java @@ -25,7 +25,7 @@ import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; -import static org.mockito.Matchers.contains; +import static org.mockito.ArgumentMatchers.contains; import static org.mockito.Mockito.mock; import java.io.Serializable; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java index 5598e3d2e4..e5e13268b2 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java @@ -19,24 +19,390 @@ */ package org.onap.so.bpmn.common.resource; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Rule; +import org.junit.Test; +import org.mockito.Mock; +import org.onap.so.BaseTest; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.springframework.core.env.Environment; + +import static com.github.tomakehurst.wiremock.client.WireMock.*; + -public class ResourceRequestBuilderTest { +public class ResourceRequestBuilderTest extends BaseTest { @Test - public void buildResouceRequestTest() throws Exception { + public void getResourceInputTest() throws Exception { - ResourceRequestBuilder.buildResouceRequest("xxxxxx", - "a1074969-944f-4ddc-b687-9550b0c8cd57", new HashMap<>()); + + + stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5")) + .willReturn(ok("{ \"serviceResources\" : {\n" + + "\t\"modelInfo\" : {\n" + + "\t\t\"modelName\" : \"demoVFWCL\",\n" + + "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n" + + "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n" + + "\t\t\"modelVersion\" : \"1.0\"\n" + + "\t},\n" + + "\t\"serviceType\" : \"\",\n" + + "\t\"serviceRole\" : \"\",\n" + + "\t\"environmentContext\" : null,\n" + + "\t\"resourceOrder\" : \"res1,res2\",\n" + + "\t\"workloadContext\" : \"Production\",\n" + + "\t\"serviceVnfs\": [\n" + + "\t\n" + + "\t\t{ \"modelInfo\" : {\n" + + "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n" + + "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n" + + "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n" + + "\t\t\t\"modelVersion\" : \"1.0\",\n" + + "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n" + + "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" + + "\t\t\t},\n" + + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n" + + "\t\t\"nfFunction\" \t: null,\n" + + "\"resourceInput\":\"{\\\"a\\\":\\\"b\\\"}\"," + + "\t\t\"nfType\" \t\t: null,\n" + + "\t\t\"nfRole\" \t\t: null,\n" + + "\t\t\"nfNamingCode\" \t: null,\n" + + "\t\t\"multiStageDesign\" : \"false\",\n" + + "\t\t\t\"vfModules\": [\n" + + "\t\t\t\t{\n" + + "\t\t\t\t\t\"modelInfo\" : { \n" + + "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n" + + "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n" + + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n" + + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" + + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n" + + "\t\t\t\t\t},\t\t\"isBase\" : true,\n" + + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n" + + "\t\t\t\t\t\"initialCount\" : 1,\n" + + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + + "\t\t\t\t}\n" + + "\t\t\t]\n" + + "\t\t},\n" + + "\t\n" + + "\t\t{ \"modelInfo\" : {\n" + + "\t\t\t\"modelName\" : \"f971106a-248f-4202-9d1f\",\n" + + "\t\t\t\"modelUuid\" : \"4fbc08a4-35ed-4a59-9e47-79975e4add7e\",\n" + + "\t\t\t\"modelInvariantUuid\" : \"c669799e-adf1-46ae-8c70-48b326fe89f3\",\n" + + "\t\t\t\"modelVersion\" : \"1.0\",\n" + + "\t\t\t\"modelCustomizationUuid\" : \"e776449e-2b10-45c5-9217-2775c88ca1a0\",\n" + + "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" + + "\t\t\t},\n" + + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n" + + "\t\t\"nfFunction\" \t: null,\n" + + "\t\t\"nfType\" \t\t: null,\n" + + "\t\t\"nfRole\" \t\t: null,\n" + + "\"resourceInput\":\"{\\\"a\\\":\\\"key|default_value\\\"}\"," + + "\t\t\"nfNamingCode\" \t: null,\n" + + "\t\t\"multiStageDesign\" : \"false\",\n" + + "\t\t\t\"vfModules\": [\n" + + "\t\t\t\t{\n" + + "\t\t\t\t\t\"modelInfo\" : { \n" + + "\t\t\t\t\t\t\"modelName\" : \"F971106a248f42029d1f..base_vpkg..module-0\",\n" + + "\t\t\t\t\t\t\"modelUuid\" : \"47d5273a-7456-4786-9035-b3911944cc35\",\n" + + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"0ea3e57e-ac7a-425a-928b-b4aee8806c15\",\n" + + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" + + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"9ed9fef6-d3f8-4433-9807-7e23393a16bc\"\n" + + "\t\t\t\t\t},\t\t\"isBase\" : true,\n" + + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vpkg\",\n" + + "\t\t\t\t\t\"initialCount\" : 1,\n" + + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + + "\t\t\t\t}\n" + + "\t\t\t]\n" + + "\t\t}\n" + + "\t],\n" + + "\t\"serviceNetworks\": [],\n" + + "\t\"serviceAllottedResources\": []\n" + + "\t}}"))); + +// when(UrnPropertiesReader.getVariable(anyString())).thenReturn("http://localhost:8080"); + HashMap serviceInput = new HashMap(); + serviceInput.put("key", "value"); + Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5", + "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput); + assertEquals(stringObjectMap.get("a"), "value"); } @Test - public void buildResouceRequestParametersTest() throws Exception { + public void getResourceInputDefaultValueTest() throws Exception { + + stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5")) + .willReturn(ok("{ \"serviceResources\" : {\n" + + "\t\"modelInfo\" : {\n" + + "\t\t\"modelName\" : \"demoVFWCL\",\n" + + "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n" + + "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n" + + "\t\t\"modelVersion\" : \"1.0\"\n" + + "\t},\n" + + "\t\"serviceType\" : \"\",\n" + + "\t\"serviceRole\" : \"\",\n" + + "\t\"environmentContext\" : null,\n" + + "\t\"workloadContext\" : \"Production\",\n" + + "\t\"serviceVnfs\": [\n" + + "\t\n" + + "\t\t{ \"modelInfo\" : {\n" + + "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n" + + "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n" + + "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n" + + "\t\t\t\"modelVersion\" : \"1.0\",\n" + + "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n" + + "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" + + "\t\t\t},\n" + + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n" + + "\t\t\"nfFunction\" \t: null,\n" + + "\"resourceInput\":\"{\\\"a\\\":\\\"b\\\"}\"," + + "\t\t\"nfType\" \t\t: null,\n" + + "\t\t\"nfRole\" \t\t: null,\n" + + "\t\t\"nfNamingCode\" \t: null,\n" + + "\t\t\"multiStageDesign\" : \"false\",\n" + + "\t\t\t\"vfModules\": [\n" + + "\t\t\t\t{\n" + + "\t\t\t\t\t\"modelInfo\" : { \n" + + "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n" + + "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n" + + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n" + + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" + + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n" + + "\t\t\t\t\t},\t\t\"isBase\" : true,\n" + + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n" + + "\t\t\t\t\t\"initialCount\" : 1,\n" + + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + + "\t\t\t\t}\n" + + "\t\t\t]\n" + + "\t\t},\n" + + "\t\n" + + "\t\t{ \"modelInfo\" : {\n" + + "\t\t\t\"modelName\" : \"f971106a-248f-4202-9d1f\",\n" + + "\t\t\t\"modelUuid\" : \"4fbc08a4-35ed-4a59-9e47-79975e4add7e\",\n" + + "\t\t\t\"modelInvariantUuid\" : \"c669799e-adf1-46ae-8c70-48b326fe89f3\",\n" + + "\t\t\t\"modelVersion\" : \"1.0\",\n" + + "\t\t\t\"modelCustomizationUuid\" : \"e776449e-2b10-45c5-9217-2775c88ca1a0\",\n" + + "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" + + "\t\t\t},\n" + + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n" + + "\t\t\"nfFunction\" \t: null,\n" + + "\t\t\"nfType\" \t\t: null,\n" + + "\t\t\"nfRole\" \t\t: null,\n" + + "\"resourceInput\":\"{\\\"a\\\":\\\"key|default_value\\\"}\"," + + "\t\t\"nfNamingCode\" \t: null,\n" + + "\t\t\"multiStageDesign\" : \"false\",\n" + + "\t\t\t\"vfModules\": [\n" + + "\t\t\t\t{\n" + + "\t\t\t\t\t\"modelInfo\" : { \n" + + "\t\t\t\t\t\t\"modelName\" : \"F971106a248f42029d1f..base_vpkg..module-0\",\n" + + "\t\t\t\t\t\t\"modelUuid\" : \"47d5273a-7456-4786-9035-b3911944cc35\",\n" + + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"0ea3e57e-ac7a-425a-928b-b4aee8806c15\",\n" + + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" + + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"9ed9fef6-d3f8-4433-9807-7e23393a16bc\"\n" + + "\t\t\t\t\t},\t\t\"isBase\" : true,\n" + + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vpkg\",\n" + + "\t\t\t\t\t\"initialCount\" : 1,\n" + + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + + "\t\t\t\t}\n" + + "\t\t\t]\n" + + "\t\t}\n" + + "\t],\n" + + "\t\"serviceNetworks\": [],\n" + + "\t\"serviceAllottedResources\": []\n" + + "\t}}"))); + +// when(UrnPropertiesReader.getVariable(anyString())).thenReturn("http://localhost:8080"); + HashMap serviceInput = new HashMap(); + serviceInput.put("key1", "value"); + Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5", + "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput); + assertEquals(stringObjectMap.get("a"), "default_value"); + } + + @Test + public void getResourceInputValueNoDefaultTest() throws Exception { + + stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5")) + .willReturn(ok("{ \"serviceResources\" : {\n" + + "\t\"modelInfo\" : {\n" + + "\t\t\"modelName\" : \"demoVFWCL\",\n" + + "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n" + + "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n" + + "\t\t\"modelVersion\" : \"1.0\"\n" + + "\t},\n" + + "\t\"serviceType\" : \"\",\n" + + "\t\"serviceRole\" : \"\",\n" + + "\t\"environmentContext\" : null,\n" + + "\t\"workloadContext\" : \"Production\",\n" + + "\t\"serviceVnfs\": [\n" + + "\t\n" + + "\t\t{ \"modelInfo\" : {\n" + + "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n" + + "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n" + + "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n" + + "\t\t\t\"modelVersion\" : \"1.0\",\n" + + "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n" + + "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" + + "\t\t\t},\n" + + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n" + + "\t\t\"nfFunction\" \t: null,\n" + + "\"resourceInput\":\"{\\\"a\\\":\\\"b\\\"}\"," + + "\t\t\"nfType\" \t\t: null,\n" + + "\t\t\"nfRole\" \t\t: null,\n" + + "\t\t\"nfNamingCode\" \t: null,\n" + + "\t\t\"multiStageDesign\" : \"false\",\n" + + "\t\t\t\"vfModules\": [\n" + + "\t\t\t\t{\n" + + "\t\t\t\t\t\"modelInfo\" : { \n" + + "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n" + + "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n" + + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n" + + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" + + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n" + + "\t\t\t\t\t},\t\t\"isBase\" : true,\n" + + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n" + + "\t\t\t\t\t\"initialCount\" : 1,\n" + + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + + "\t\t\t\t}\n" + + "\t\t\t]\n" + + "\t\t},\n" + + "\t\n" + + "\t\t{ \"modelInfo\" : {\n" + + "\t\t\t\"modelName\" : \"f971106a-248f-4202-9d1f\",\n" + + "\t\t\t\"modelUuid\" : \"4fbc08a4-35ed-4a59-9e47-79975e4add7e\",\n" + + "\t\t\t\"modelInvariantUuid\" : \"c669799e-adf1-46ae-8c70-48b326fe89f3\",\n" + + "\t\t\t\"modelVersion\" : \"1.0\",\n" + + "\t\t\t\"modelCustomizationUuid\" : \"e776449e-2b10-45c5-9217-2775c88ca1a0\",\n" + + "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" + + "\t\t\t},\n" + + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n" + + "\t\t\"nfFunction\" \t: null,\n" + + "\t\t\"nfType\" \t\t: null,\n" + + "\t\t\"nfRole\" \t\t: null,\n" + + "\"resourceInput\":\"{\\\"a\\\":\\\"value\\\"}\"," + + "\t\t\"nfNamingCode\" \t: null,\n" + + "\t\t\"multiStageDesign\" : \"false\",\n" + + "\t\t\t\"vfModules\": [\n" + + "\t\t\t\t{\n" + + "\t\t\t\t\t\"modelInfo\" : { \n" + + "\t\t\t\t\t\t\"modelName\" : \"F971106a248f42029d1f..base_vpkg..module-0\",\n" + + "\t\t\t\t\t\t\"modelUuid\" : \"47d5273a-7456-4786-9035-b3911944cc35\",\n" + + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"0ea3e57e-ac7a-425a-928b-b4aee8806c15\",\n" + + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" + + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"9ed9fef6-d3f8-4433-9807-7e23393a16bc\"\n" + + "\t\t\t\t\t},\t\t\"isBase\" : true,\n" + + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vpkg\",\n" + + "\t\t\t\t\t\"initialCount\" : 1,\n" + + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + + "\t\t\t\t}\n" + + "\t\t\t]\n" + + "\t\t}\n" + + "\t],\n" + + "\t\"serviceNetworks\": [],\n" + + "\t\"serviceAllottedResources\": []\n" + + "\t}}"))); + +// when(UrnPropertiesReader.getVariable(anyString())).thenReturn("http://localhost:8080"); + HashMap serviceInput = new HashMap(); + serviceInput.put("key1", "value"); + Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5", + "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput); + assertEquals(stringObjectMap.get("a"), "value"); + } + + @Test + public void getResourceSequenceTest() throws Exception { + + stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5")) + .willReturn(ok("{ \"serviceResources\" : {\n" + + "\t\"modelInfo\" : {\n" + + "\t\t\"modelName\" : \"demoVFWCL\",\n" + + "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n" + + "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n" + + "\t\t\"modelVersion\" : \"1.0\"\n" + + "\t},\n" + + "\t\"serviceType\" : \"\",\n" + + "\t\"serviceRole\" : \"\",\n" + + "\t\"environmentContext\" : null,\n" + + "\t\"resourceOrder\" : \"res1,res2\",\n" + + "\t\"workloadContext\" : \"Production\",\n" + + "\t\"serviceVnfs\": [\n" + + "\t\n" + + "\t\t{ \"modelInfo\" : {\n" + + "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n" + + "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n" + + "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n" + + "\t\t\t\"modelVersion\" : \"1.0\",\n" + + "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n" + + "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" + + "\t\t\t},\n" + + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n" + + "\t\t\"nfFunction\" \t: null,\n" + + "\"resourceInput\":\"{\\\"a\\\":\\\"b\\\"}\"," + + "\t\t\"nfType\" \t\t: null,\n" + + "\t\t\"nfRole\" \t\t: null,\n" + + "\t\t\"nfNamingCode\" \t: null,\n" + + "\t\t\"multiStageDesign\" : \"false\",\n" + + "\t\t\t\"vfModules\": [\n" + + "\t\t\t\t{\n" + + "\t\t\t\t\t\"modelInfo\" : { \n" + + "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n" + + "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n" + + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n" + + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" + + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n" + + "\t\t\t\t\t},\t\t\"isBase\" : true,\n" + + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n" + + "\t\t\t\t\t\"initialCount\" : 1,\n" + + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + + "\t\t\t\t}\n" + + "\t\t\t]\n" + + "\t\t},\n" + + "\t\n" + + "\t\t{ \"modelInfo\" : {\n" + + "\t\t\t\"modelName\" : \"f971106a-248f-4202-9d1f\",\n" + + "\t\t\t\"modelUuid\" : \"4fbc08a4-35ed-4a59-9e47-79975e4add7e\",\n" + + "\t\t\t\"modelInvariantUuid\" : \"c669799e-adf1-46ae-8c70-48b326fe89f3\",\n" + + "\t\t\t\"modelVersion\" : \"1.0\",\n" + + "\t\t\t\"modelCustomizationUuid\" : \"e776449e-2b10-45c5-9217-2775c88ca1a0\",\n" + + "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" + + "\t\t\t},\n" + + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n" + + "\t\t\"nfFunction\" \t: null,\n" + + "\t\t\"nfType\" \t\t: null,\n" + + "\t\t\"nfRole\" \t\t: null,\n" + + "\"resourceInput\":\"{\\\"a\\\":\\\"key|default_value\\\"}\"," + + "\t\t\"nfNamingCode\" \t: null,\n" + + "\t\t\"multiStageDesign\" : \"false\",\n" + + "\t\t\t\"vfModules\": [\n" + + "\t\t\t\t{\n" + + "\t\t\t\t\t\"modelInfo\" : { \n" + + "\t\t\t\t\t\t\"modelName\" : \"F971106a248f42029d1f..base_vpkg..module-0\",\n" + + "\t\t\t\t\t\t\"modelUuid\" : \"47d5273a-7456-4786-9035-b3911944cc35\",\n" + + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"0ea3e57e-ac7a-425a-928b-b4aee8806c15\",\n" + + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" + + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"9ed9fef6-d3f8-4433-9807-7e23393a16bc\"\n" + + "\t\t\t\t\t},\t\t\"isBase\" : true,\n" + + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vpkg\",\n" + + "\t\t\t\t\t\"initialCount\" : 1,\n" + + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + + "\t\t\t\t}\n" + + "\t\t\t]\n" + + "\t\t}\n" + + "\t],\n" + + "\t\"serviceNetworks\": [],\n" + + "\t\"serviceAllottedResources\": []\n" + + "\t}}"))); - String parameters = - "{ \"locationConstraints\":[ ], \"resources\":[ { \"resourceName\":\"vEPC_ONAP01\", \"resourceInvariantUuid\":\"36ebe421-283a-4ee8-92f1-d09e7c44b911\", \"resourceUuid\":\"27a0e235-b67a-4ea4-a0cf-25761afed111\", \"resourceCustomizationUuid\":\"27a0e235-b67a-4ea4-a0cf-25761afed231\", \"parameters\":{ \"locationConstraints\":[ { \"vnfProfileId\":\"b244d433-8c9c-49ad-9c70-8e34b8dc8328\", \"locationConstraints\":{ \"vimId\":\"vmware_vio\" } }, { \"vnfProfileId\":\"8a9f7c48-21ce-41b7-95b8-a8ac61ccb1ff\", \"locationConstraints\":{ \"vimId\":\"core-dc_RegionOne\" } } ], \"resources\":[ ], \"requestInputs\":{ \"sdncontroller\":\"\" } } }, { \"resourceName\":\"VL OVERLAYTUNNEL\", \"resourceInvariantUuid\":\"184494cf-472f-436f-82e2-d83dddde21cb\", \"resourceUuid\":\"95bc3e59-c9c5-458f-ad6e-78874ab4b3cc\", \"resourceCustomizationUuid\":\"27a0e235-b67a-4ea4-a0cf-25761afed232\", \"parameters\":{ \"locationConstraints\":[ ], \"resources\":[ ], \"requestInputs\":{ } } } ], \"requestInputs\":{ \"vlunderlayvpn0_name\":\"l3connect\", \"vlunderlayvpn0_site1_id\":\"IP-WAN-Controller-1\", \"vlunderlayvpn0_site2_id\":\"SPTNController\", \"vlunderlayvpn0_site1_networkName\":\"network1,network2\", \"vlunderlayvpn0_site2_networkName\":\"network3,network4\", \"vlunderlayvpn0_site1_routerId\":\"a8098c1a-f86e-11da-bd1a-00112444be1a\", \"vlunderlayvpn0_site2_routerId\":\"a8098c1a-f86e-11da-bd1a-00112444be1e\", \"vlunderlayvpn0_site2_importRT1\":\"200:1,200:2\", \"vlunderlayvpn0_site1_exportRT1\":\"300:1,300:2\", \"vlunderlayvpn0_site2_exportRT1\":\"400:1,400:2\", \"vlunderlayvpn0_site1_vni\":\"2000\", \"vlunderlayvpn0_site2_vni\":\"3000\", \"vlunderlayvpn0_tunnelType\":\"L3-DCI\" } }"; - ResourceRequestBuilder.buildResourceRequestParameters(null, "1bd0eae6-2dcc-4461-9ae6-56d641f369d6", "27a0e235-b67a-4ea4-a0cf-25761afed231", parameters); + List<String> resourceSequence = ResourceRequestBuilder.getResourceSequence("c3954379-4efe-431c-8258-f84905b158e5"); + assertEquals(resourceSequence.size(), 2); + assertEquals(resourceSequence.get(0), "res1"); + assertEquals(resourceSequence.get(1), "res2"); } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index 78238f0271..56875d315b 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -26,7 +26,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; @@ -47,7 +47,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.Spy; @@ -711,11 +711,12 @@ public class BBInputSetupTest { String instanceName = "instanceName"; String vnfType = "vnfType"; String resourceId = "networkId"; + String productFamilyId = "productFamilyId"; Service service = Mockito.mock(Service.class); ServiceInstance serviceInstance = Mockito.mock(ServiceInstance.class); RequestDetails requestDetails = Mockito.mock(RequestDetails.class); ModelInfo modelInfo = Mockito.mock(ModelInfo.class); - RequestInfo requestInfo = Mockito.mock(RequestInfo.class); + RequestInfo requestInfo = Mockito.mock(RequestInfo.class); RelatedInstanceList[] relatedInstanceList = new RelatedInstanceList[] {}; CloudConfiguration cloudConfiguration = new CloudConfiguration(); org.onap.so.serviceinstancebeans.Platform platform = Mockito @@ -727,13 +728,14 @@ public class BBInputSetupTest { doNothing().when(SPY_bbInputSetup).populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, null); doReturn(modelInfo).when(requestDetails).getModelInfo(); + doReturn(productFamilyId).when(requestInfo).getProductFamilyId(); doReturn(requestInfo).when(requestDetails).getRequestInfo(); doReturn(instanceName).when(requestInfo).getInstanceName(); doReturn(platform).when(requestDetails).getPlatform(); doReturn(lineOfBusiness).when(requestDetails).getLineOfBusiness(); doReturn(relatedInstanceList).when(requestDetails).getRelatedInstanceList(); doReturn(cloudConfiguration).when(requestDetails).getCloudConfiguration(); - + doReturn(ModelType.network).when(modelInfo).getModelType(); SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, lookupKeyMap, resourceId, vnfType); @@ -744,11 +746,11 @@ public class BBInputSetupTest { doReturn(ModelType.vnf).when(modelInfo).getModelType(); resourceId = "vnfId"; doNothing().when(SPY_bbInputSetup).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, - service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null); + service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, productFamilyId); SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, lookupKeyMap, resourceId, vnfType); verify(SPY_bbInputSetup, times(1)).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, - service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null); + service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, productFamilyId); assertEquals("VnfId populated", true, lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID).equalsIgnoreCase(resourceId)); doReturn(ModelType.volumeGroup).when(modelInfo).getModelType(); @@ -1208,26 +1210,29 @@ public class BBInputSetupTest { doReturn(catalogInstanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup(any()); SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, - serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); + serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null, + requestDetails.getRequestInfo().getProductFamilyId()); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, - serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); + serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null, + requestDetails.getRequestInfo().getProductFamilyId()); verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf, modelInfo, service); instanceName = "vnfName2"; GenericVnf vnf2 = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, - resourceId, vnfType, null); + resourceId, vnfType, null, requestDetails.getRequestInfo().getProductFamilyId()); doReturn(vnf2).when(SPY_bbInputSetup).createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, - resourceId, vnfType, null); + resourceId, vnfType, null, requestDetails.getRequestInfo().getProductFamilyId()); doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); doNothing().when(SPY_bbInputSetup).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId2"); SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, - serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); + serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null, + requestDetails.getRequestInfo().getProductFamilyId()); verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf2, modelInfo, service); verify(SPY_bbInputSetup, times(2)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); verify(SPY_bbInputSetup, times(2)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); @@ -1297,17 +1302,19 @@ public class BBInputSetupTest { doReturn(catalogInstanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup(any()); SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, - serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); + serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null, + requestDetails.getRequestInfo().getProductFamilyId()); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, - serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); + serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null, + requestDetails.getRequestInfo().getProductFamilyId()); verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf, modelInfo, service); instanceName = "vnfName2"; GenericVnf vnf2 = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, - resourceId, vnfType, null); + resourceId, vnfType, null, requestDetails.getRequestInfo().getProductFamilyId()); org.onap.aai.domain.yang.GenericVnf vnf2AAI = new org.onap.aai.domain.yang.GenericVnf(); vnfAAI.setModelCustomizationId("modelCustId2"); @@ -1315,7 +1322,8 @@ public class BBInputSetupTest { doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf2, modelInfo, service); doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, - serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); + serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null, + requestDetails.getRequestInfo().getProductFamilyId()); verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf2, modelInfo, service); verify(SPY_bbInputSetup, times(2)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); verify(SPY_bbInputSetup, times(1)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); @@ -1768,7 +1776,7 @@ public class BBInputSetupTest { verify(SPY_bbInputSetup, times(1)).populateGenericVnf(isA(ModelInfo.class), any(String.class), isA(org.onap.so.serviceinstancebeans.Platform.class), isA(org.onap.so.serviceinstancebeans.LineOfBusiness.class), isA(Service.class), any(String.class), - isA(ServiceInstance.class), any(), any(), any(String.class), any(String.class), any()); + isA(ServiceInstance.class), any(), any(), any(String.class), any(String.class), any(), any(String.class)); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VF_MODULE.toString()); @@ -1943,7 +1951,7 @@ public class BBInputSetupTest { verify(SPY_bbInputSetup, times(1)).populateGenericVnf(isA(ModelInfo.class), any(String.class), isA(org.onap.so.serviceinstancebeans.Platform.class), isA(org.onap.so.serviceinstancebeans.LineOfBusiness.class), isA(Service.class), any(String.class), - isA(ServiceInstance.class), any(),ArgumentMatchers.isNull(), any(String.class), ArgumentMatchers.isNull(), any()); + isA(ServiceInstance.class), any(),ArgumentMatchers.isNull(), any(String.class), ArgumentMatchers.isNull(), any(), any(String.class)); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VF_MODULE.toString()); @@ -2006,7 +2014,8 @@ public class BBInputSetupTest { verify(SPY_bbInputSetup, times(1)).populateGenericVnf(isA(ModelInfo.class), any(String.class), isA(org.onap.so.serviceinstancebeans.Platform.class), isA(org.onap.so.serviceinstancebeans.LineOfBusiness.class), isA(Service.class), any(String.class), - isA(ServiceInstance.class), any(), any(), any(String.class), any(String.class), any()); + isA(ServiceInstance.class), any(), any(), any(String.class), any(String.class), any(), + any(String.class)); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VF_MODULE.toString()); @@ -2456,6 +2465,7 @@ public class BBInputSetupTest { String vnfType = "vnfType"; String platformName = "platformName"; String lineOfBusinessName = "lineOfBusinessName"; + String productFamilyId = "productFamilyId"; Platform platform = new Platform(); platform.setPlatformName(platformName); LineOfBusiness lineOfBusiness = new LineOfBusiness(); @@ -2470,6 +2480,8 @@ public class BBInputSetupTest { expected.setOrchestrationStatus(OrchestrationStatus.PRECREATED); expected.setPlatform(platform); expected.setLineOfBusiness(lineOfBusiness); + expected.setProvStatus("PREPROV"); + expected.setServiceId(productFamilyId); Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); List<Map<String, String>> instanceParams = new ArrayList<>(); instanceParams.add(cloudParams); @@ -2481,13 +2493,14 @@ public class BBInputSetupTest { doReturn(platform).when(bbInputSetupMapperLayer).mapRequestPlatform(requestPlatform); doReturn(lineOfBusiness).when(bbInputSetupMapperLayer).mapRequestLineOfBusiness(requestLineOfBusiness); - GenericVnf actual = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, requestPlatform, requestLineOfBusiness, vnfId, vnfType, instanceParams); + GenericVnf actual = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, requestPlatform, requestLineOfBusiness, vnfId, vnfType, instanceParams, + productFamilyId); assertThat(actual, sameBeanAs(expected)); assertEquals("LookupKeyMap is populated", vnfId, lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); expected.getCloudParams().clear(); - actual = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, requestPlatform, requestLineOfBusiness, vnfId, vnfType, null); + actual = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, requestPlatform, requestLineOfBusiness, vnfId, vnfType, null, productFamilyId); assertThat(actual, sameBeanAs(expected)); } @@ -2538,6 +2551,12 @@ public class BBInputSetupTest { volumeGroup.setVolumeGroupId(volumeGroupId); vnf.getVolumeGroups().add(volumeGroup); serviceInstance.getVnfs().add(vnf); + VfModule vfModule1 = new VfModule(); + vfModule1.setVfModuleId("vfModuleId1"); + VfModule vfModule2 = new VfModule(); + vfModule2.setVfModuleId("vfModuleId2"); + vnf.getVfModules().add(vfModule1); + vnf.getVfModules().add(vfModule2); Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfId); String resourceId = vfModuleId; @@ -2550,16 +2569,20 @@ public class BBInputSetupTest { vnfAAI.setModelCustomizationId("vnfModelCustId"); org.onap.aai.domain.yang.VolumeGroup volumeGroupAAI = new org.onap.aai.domain.yang.VolumeGroup(); volumeGroupAAI.setModelCustomizationId(vfModuleCustomizationId); + org.onap.aai.domain.yang.VfModule vfModuleAAI = new org.onap.aai.domain.yang.VfModule(); + vfModuleAAI.setModelCustomizationId(vfModuleCustomizationId); doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId()); doReturn(volumeGroupAAI).when(SPY_bbInputSetupUtils).getAAIVolumeGroup(CLOUD_OWNER, cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + doReturn(vfModuleAAI).when(SPY_bbInputSetupUtils).getAAIVfModule(isA(String.class), isA(String.class)); doNothing().when(SPY_bbInputSetup).mapCatalogVnf(isA(GenericVnf.class), isA(ModelInfo.class), isA(Service.class)); doNothing().when(SPY_bbInputSetup).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), isA(Service.class), isA(String.class)); SPY_bbInputSetup.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, relatedInstanceList, instanceName, instanceParams, cloudConfiguration); + verify(SPY_bbInputSetup, times(3)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), isA(Service.class), isA(String.class)); assertEquals("Lookup Key Map populated with VfModule Id", vfModuleId, lookupKeyMap.get(ResourceKey.VF_MODULE_ID)); assertEquals("Lookup Key Map populated with VolumeGroup Id", volumeGroupId, lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID)); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java index f70912f725..ae1af8f960 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java @@ -25,7 +25,7 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java index d53b2ae713..af7dc582e0 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java @@ -24,7 +24,7 @@ import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; -import static org.mockito.Matchers.isA; +import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doReturn; import java.io.File; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java index cb5683dcc8..6344a3f1a6 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java @@ -93,7 +93,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { vnf.setVnfType("vnft1"); delegateExecution.setVariable("aLaCarte", true); delegateExecution.setVariable("suppressRollback", false); - + delegateExecution.setVariable("WorkflowExceptionCode", "7000"); RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); rainyDayHandlerStatus.setErrorCode("7000"); rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB"); @@ -116,7 +116,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { vnf.setVnfType("vnft1"); delegateExecution.setVariable("aLaCarte", true); delegateExecution.setVariable("suppressRollback", false); - + delegateExecution.setVariable("WorkflowExceptionCode", ASTERISK); RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); rainyDayHandlerStatus.setErrorCode(ASTERISK); rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB"); @@ -131,6 +131,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution,true); assertEquals("Rollback", delegateExecution.getVariable("handlingCode")); + assertEquals(5,delegateExecution.getVariable("maxRetries")); } @Test @@ -164,7 +165,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { vnf.setVnfType("vnft1"); delegateExecution.setVariable("aLaCarte", true); delegateExecution.setVariable("suppressRollback", false); - + delegateExecution.setVariable("WorkflowExceptionCode", "7000"); RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); rainyDayHandlerStatus.setErrorCode("7000"); rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB"); @@ -188,7 +189,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { vnf.setVnfType("vnft1"); delegateExecution.setVariable("aLaCarte", false); delegateExecution.setVariable("suppressRollback", false); - + delegateExecution.setVariable("WorkflowExceptionCode", "7000"); RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); rainyDayHandlerStatus.setErrorCode("7000"); rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB"); @@ -212,7 +213,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { vnf.setVnfType("vnft1"); delegateExecution.setVariable("aLaCarte", true); delegateExecution.setVariable("suppressRollback", false); - + delegateExecution.setVariable("WorkflowExceptionCode", "7000"); RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); rainyDayHandlerStatus.setErrorCode("7000"); rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB"); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java index dbf2eb75fd..c50a6db178 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java @@ -26,6 +26,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; import java.io.File; import java.io.IOException; @@ -46,6 +47,7 @@ public class DmaapPropertiesClientTest extends BaseTest{ @Autowired private DmaapPropertiesClient dmaapPropertiesClient; + private final String file = "src/test/resources/org/onap/so/client/avpn/dmaap/avpnDmaapAsyncRequestStatus.json"; private String requestId = "rq1234d1-5a33-55df-13ab-12abad84e331"; private String clientSource = "SPP"; @@ -73,7 +75,7 @@ public class DmaapPropertiesClientTest extends BaseTest{ @Test public void testDmaapPublishRequest() throws JsonProcessingException, MapperException { - stubFor(post(urlEqualTo("/events/com.att.mso.asyncStatusUpdate?timeout=20000")) + stubFor(post(urlEqualTo("/events/com.att.mso.asyncStatusUpdate?timeout=60000")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); dmaapPropertiesClient.dmaapPublishRequest(requestId, clientSource, correlator, serviceInstanceId, startTime, finishTime, requestScope, diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java index d380536a48..fc69f812be 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java @@ -21,6 +21,7 @@ package org.onap.so.client.dmaapproperties; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import org.junit.Test; import org.onap.so.BaseTest; @@ -30,7 +31,8 @@ public class GlobalDmaapPublisherTest extends BaseTest{ @Autowired private GlobalDmaapPublisher globalDmaapPublisher; - + + @Test public void testGetters() { assertEquals("81B7E3533B91A6706830611FB9A8ECE529BBCCE754B1F1520FA7C8698B42F97235BEFA993A387E664D6352C63A6185D68DA7F0B1D360637CBA102CB166E3E62C11EB1F75386D3506BCECE51E54", globalDmaapPublisher.getAuth()); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java index d1013e7541..2e25449937 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java @@ -21,7 +21,7 @@ package org.onap.so.client.exception; import static org.junit.Assert.assertEquals; - +import static org.junit.Assert.assertTrue; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Test; import org.onap.so.bpmn.mock.FileUtil; @@ -32,6 +32,7 @@ public class ExceptionBuilderTest extends BaseTest { private static final String RESOURCE_PATH = "__files/"; private static final String VALID_ERROR_MESSAGE = "{test error message}"; + @Test public void buildAndThrowWorkflowExceptionTest() { try { diff --git a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml index b229fbd26a..afdb800ffe 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml +++ b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml @@ -84,7 +84,7 @@ mso: callbackRetryAttempts: '5' catalog: db: - endpoint: http://localhost:${wiremock.server.port}/ + endpoint: http://localhost:${wiremock.server.port}/ecomp/mso/catalog spring: endpoint: http://localhost:${wiremock.server.port} correlation: diff --git a/bpmn/MSOCommonBPMN/src/test/resources/vfModuleCount.xml b/bpmn/MSOCommonBPMN/src/test/resources/vfModuleCount.xml new file mode 100644 index 0000000000..b7dee68a77 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/vfModuleCount.xml @@ -0,0 +1,44 @@ +<vfModules> + <vf-module> + <module-index>0</module-index> + </vf-module> + <vf-module> + <module-index>1</module-index> + </vf-module> + <vf-module> + <module-index>2</module-index> + </vf-module> + <vf-module> + <module-index>3</module-index> + </vf-module> + <vf-module> + <module-index>4</module-index> + </vf-module> + <vf-module> + <module-index>5</module-index> + </vf-module> + <vf-module> + <module-index>6</module-index> + </vf-module> + <vf-module> + <module-index>7</module-index> + </vf-module> + <vf-module> + <module-index>8</module-index> + </vf-module> + <vf-module> + <module-index>9</module-index> + </vf-module> + <vf-module> + <module-index>10</module-index> + </vf-module> + <vf-module> + <module-index>11</module-index> + </vf-module> + <vf-module> + <module-index>12</module-index> + </vf-module> + <vf-module> + <module-index>13</module-index> + </vf-module> +</vfModules>
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/RollbackData.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/RollbackData.java index 9c80548490..52207f2156 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/RollbackData.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/RollbackData.java @@ -25,24 +25,26 @@ import java.util.HashMap; import java.util.Map; import java.util.stream.Collectors; +import com.fasterxml.jackson.annotation.JsonProperty; + /** - * An object that stores data for rollbacks. Data is organized by type. A - * type is simply a string identifier. Multiple types of data may be stored - * in the same object for separate rollback operations. + * An object that stores data for rollbacks. Data is organized by type. A type is simply a string + * identifier. Multiple types of data may be stored in the same object for separate rollback + * operations. */ public class RollbackData implements Serializable { private static final long serialVersionUID = 1L; - private Map<String, Map<String, Serializable>> dictionary = - new HashMap<>(); + @JsonProperty + private final Map<String, Map<String, Serializable>> dictionary = new HashMap<>(); /** * Returns true if the specified type is stored in this object. * * @param type the data type */ - public boolean hasType(String type) { + public boolean hasType(final String type) { return dictionary.containsKey(type); } @@ -53,9 +55,8 @@ public class RollbackData implements Serializable { * @param key the key * @param value the value */ - public void put(String type, String key, String value) { - Map<String, Serializable> mapForType = dictionary - .computeIfAbsent(type, k -> new HashMap<>()); + public void put(final String type, final String key, final String value) { + final Map<String, Serializable> mapForType = dictionary.computeIfAbsent(type, k -> new HashMap<>()); mapForType.put(key, value); } @@ -67,8 +68,8 @@ public class RollbackData implements Serializable { * @param key the key * @return the item or null if there is no item for the specified type and key */ - public Serializable get(String type, String key) { - Map<String, Serializable> mapForType = dictionary.get(type); + public Serializable get(final String type, final String key) { + final Map<String, Serializable> mapForType = dictionary.get(type); if (mapForType == null) { return null; @@ -83,7 +84,7 @@ public class RollbackData implements Serializable { * @param type the data type * @return a map, or null if there are no items associated with the specified data type */ - public Map<String, Serializable> get(String type) { + public Map<String, Serializable> get(final String type) { return dictionary.get(type); } diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java index f143346cae..c7c7bba20c 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java @@ -22,6 +22,8 @@ package org.onap.so.bpmn.core.domain; import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonRootName; /** @@ -55,6 +57,9 @@ public class AllottedResource extends Resource { private String nfNamingCode; private String orchestrationStatus; + @JsonIgnore + private String resourceInput; + /* * GET and SET */ @@ -119,4 +124,13 @@ public class AllottedResource extends Resource { public void setOrchestrationStatus(String orchestrationStatus) { this.orchestrationStatus = orchestrationStatus; } + + + public String getResourceInput() { + return resourceInput; + } + + public void setResourceInput(String resourceInput) { + this.resourceInput = resourceInput; + } }
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java index 20ab3ecc84..f0e97f15ef 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java @@ -22,6 +22,8 @@ package org.onap.so.bpmn.core.domain; import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonRootName; @@ -47,7 +49,10 @@ public class NetworkResource extends Resource { private String networkRole; private String networkTechnology; private String networkScope; - + + @JsonIgnore + private String resourceInput; + /* * GET and SET */ @@ -75,4 +80,12 @@ public class NetworkResource extends Resource { public void setNetworkScope(String networkScope) { this.networkScope = networkScope; } + + public String getResourceInput() { + return resourceInput; + } + + public void setResourceInput(String resourceInput) { + this.resourceInput = resourceInput; + } }
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java index 4295f50a3c..5cdbbcb7c9 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java @@ -23,6 +23,8 @@ package org.onap.so.bpmn.core.domain; import java.io.Serializable; import java.util.Map; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonRootName; /** @@ -32,6 +34,7 @@ import com.fasterxml.jackson.annotation.JsonRootName; * @author cb645j * */ +@JsonIgnoreProperties(ignoreUnknown = true) public class ServiceInstance extends JsonWrapper implements Serializable { private static final long serialVersionUID = 1L; diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java index dc76ab0bc7..a7e5389583 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java @@ -25,6 +25,7 @@ import java.util.List; import java.util.UUID; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -59,6 +60,9 @@ public class VnfResource extends Resource { private String multiStageDesign; private String orchestrationStatus; + @JsonIgnore + private String resourceInput; + /* * GET and SET */ @@ -123,6 +127,15 @@ public class VnfResource extends Resource { public void setOrchestrationStatus(String orchestrationStatus){ this.orchestrationStatus = orchestrationStatus; } + + public String getResourceInput() { + return resourceInput; + } + + public void setResourceInput(String resourceInput) { + this.resourceInput = resourceInput; + } + /** * Returns a list of all VfModule objects. * Base module is first entry in the list diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java index ee53148e44..35f76908e3 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java @@ -927,7 +927,7 @@ public class JsonUtils { for (int i = 0; i < arr.length(); i++){ JSONObject jo = arr.getJSONObject(i); String key = jo.getString(keyNode); - String value = jo.getString(valueNode); + String value = jo.get(valueNode).toString(); map.put(key, value); } msoLogger.debug("Completed Entry Array To Map Util Method"); @@ -954,7 +954,7 @@ public class JsonUtils { for(int i = 0; i < arr.length(); i++){ JSONObject jo = arr.getJSONObject(i); String key = jo.getString(keyNode); - String value = jo.getString(valueNode); + String value = jo.get(valueNode).toString(); map.put(key, value); } msoLogger.debug("Completed Entry Array To Map Util Method"); diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/AllottedResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/AllottedResourceTest.java index b1dd8659cd..cca28d411f 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/AllottedResourceTest.java +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/AllottedResourceTest.java @@ -21,8 +21,11 @@ package org.onap.so.bpmn.core.domain; import static org.junit.Assert.*; +import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Test; +import java.io.IOException; + public class AllottedResourceTest { private AllottedResource ar = new AllottedResource(); @@ -51,4 +54,13 @@ public class AllottedResourceTest { } + @Test + public void allottedResourceMapperTest() throws IOException { + String jsonStr = "{\"allottedResourceType\": \"code123\", \"resourceInput\": \"sample\"}"; + ObjectMapper objectMapper = new ObjectMapper(); + AllottedResource vnfResource = objectMapper.readValue(jsonStr, AllottedResource.class); + + assertTrue(vnfResource != null); + } + } diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/NetworkResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/NetworkResourceTest.java index 6ca9cef8d2..ee23ebd438 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/NetworkResourceTest.java +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/NetworkResourceTest.java @@ -21,8 +21,11 @@ package org.onap.so.bpmn.core.domain; import static org.junit.Assert.*; +import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Test; +import java.io.IOException; + public class NetworkResourceTest { private NetworkResource nr = new NetworkResource(); @@ -39,4 +42,13 @@ public class NetworkResourceTest { } + @Test + public void networkResourceMapperTest() throws IOException { + String jsonStr = "{\"networkScope\": \"code123\", \"resourceInput\": \"sample\"}"; + ObjectMapper objectMapper = new ObjectMapper(); + NetworkResource networkResource = objectMapper.readValue(jsonStr, NetworkResource.class); + + assertTrue(networkResource != null); + } + } diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceInstanceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceInstanceTest.java index 7cacc9da88..c04dc9d601 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceInstanceTest.java +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceInstanceTest.java @@ -21,8 +21,10 @@ package org.onap.so.bpmn.core.domain; import static org.junit.Assert.*; +import java.io.IOException; import java.util.Map; +import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Test; public class ServiceInstanceTest { @@ -58,4 +60,12 @@ public class ServiceInstanceTest { } + @Test + public void serviceInstanceMapperTest() throws IOException { + String jsonStr = "{\"workloadContext\": \"code123\", \"resourceOrder\": \"sample\"}"; + ObjectMapper objectMapper = new ObjectMapper(); + ServiceInstance serviceInstance = objectMapper.readValue(jsonStr, ServiceInstance.class); + assertTrue(serviceInstance != null); + } + } diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java index 24947e9a8d..a83337fc5b 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java @@ -21,8 +21,10 @@ package org.onap.so.bpmn.core.domain; import static org.junit.Assert.*; +import java.io.IOException; import java.util.List; +import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Test; public class VnfResourceTest { @@ -52,4 +54,13 @@ public class VnfResourceTest { } + @Test + public void vnfResourceMapperTest() throws IOException { + String jsonStr = "{\"vnfHostname\": \"home\", \"resourceInput\": \"sample\"}"; + ObjectMapper objectMapper = new ObjectMapper(); + VnfResource vnfResource = objectMapper.readValue(jsonStr, VnfResource.class); + + assertTrue(vnfResource != null); + } + } diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/internal/VariableNameExtractorTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/internal/VariableNameExtractorTest.java index e32bc88b7c..14b8c49655 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/internal/VariableNameExtractorTest.java +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/internal/VariableNameExtractorTest.java @@ -21,7 +21,7 @@ package org.onap.so.bpmn.core.internal; import static org.hamcrest.CoreMatchers.containsString; import static org.junit.Assert.*; -import static org.mockito.Matchers.contains; +import static org.mockito.ArgumentMatchers.contains; import java.util.Optional; import org.junit.Test; diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtilsTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtilsTest.java index 6748128f05..067ae9806d 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtilsTest.java +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtilsTest.java @@ -81,7 +81,19 @@ public class JsonUtilsTest { JSONArray assignmentInfo = homingDataJson.getJSONArray("assignmentInfo"); Map<String, String> map = utils.entryArrayToMap(assignmentInfo.toString(), "variableName", "variableValue"); assertEquals(map.get("cloudOwner"), "CloudOwner"); - } + } + @Test + public void entryArrayToMapStringTestOof() throws IOException { + JsonUtils utils = new JsonUtils(); + String response = this.getJson("OofExample.json"); + String entry = JsonUtils.getJsonValue(response, "solutions.placementSolutions"); + JSONArray arr = new JSONArray(entry); + JSONArray arr2 = arr.getJSONArray(0); + JSONObject homingDataJson = arr2.getJSONObject(0); + JSONArray assignmentInfo = homingDataJson.getJSONArray("assignmentInfo"); + Map<String, String> map = utils.entryArrayToMap(assignmentInfo.toString(), "key", "value"); + assertEquals(map.get("cloudOwner"), "HPA-cloud"); + } @Test public void getJsonRootPropertyTest() throws IOException { String response = this.getJson("SDNCServiceResponseExample.json"); diff --git a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/OofExample.json b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/OofExample.json new file mode 100644 index 0000000000..127748a5e8 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/OofExample.json @@ -0,0 +1,110 @@ +{ + "requestStatus":"completed", + "statusMessage":"", + "solutions":{ + "placementSolutions":[ + [ + { + "serviceResourceId":"78976677-bca7-446a-8b31-52b83e9aa925", + "resourceModuleName":"7400fd06C75f4a44A68f", + "solution":{ + "identifierType":"cloudRegionId", + "cloudOwner":"HPA-cloud", + "identifiers":[ + "Cloud-region3" + ] + }, + "assignmentInfo":[ + { + "value":"false", + "key":"isRehome" + }, + { + "value":"att_aic", + "key":"locationType" + }, + { + "value":"Cloud-region3", + "key":"locationId" + }, + { + "value":{ + "directives":[ + { + "directives":[ + { + "attributes":[ + { + "attribute_value":"Flavor31", + "attribute_name":"label_1" + } + ], + "type":"flavor_directives" + }, + { + "attributes":[ + { + "attribute_value":"direct", + "attribute_name":"oof_returned_vnic_type_for_firewall_protected" + } + ], + "type":"sriovNICNetwork_directives" + } + ], + "type":"vnfc", + "id":"vfw_1" + }, + { + "directives":[ + { + "attributes":[ + { + "attribute_value":"Flavor32", + "attribute_name":"label_2" + } + ], + "type":"flavor_directives" + } + ], + "type":"vnfc", + "id":"vfw_2" + }, + { + "directives":[ + { + "attributes":[ + { + "attribute_value":"Flavor32", + "attribute_name":"label_3" + } + ], + "type":"flavor_directives" + } + ], + "type":"vnfc", + "id":"vfw_3" + } + ] + }, + "key":"oof_directives" + }, + { + "value":"DLLSTX233", + "key":"cloudClli" + }, + { + "value":"75919", + "key":"aic_version" + }, + { + "value":"HPA-cloud", + "key":"cloudOwner" + } + ] + } + ] + ] + }, + "transactionId":"", + "requestId":"05da4f90-15f7-4128-8ac4-e06dc3cc06f9" +}
\ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml index fb5d0108ba..5d0d05df92 100644 --- a/bpmn/mso-infrastructure-bpmn/pom.xml +++ b/bpmn/mso-infrastructure-bpmn/pom.xml @@ -164,6 +164,11 @@ <version>${camunda.springboot.version}</version> </dependency> <dependency> + <groupId>org.camunda.bpm.springboot</groupId> + <artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId> + <version>2.3.0</version> + </dependency> + <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml index 203988a1a3..829fc12474 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml @@ -2,7 +2,9 @@ server: port: 8080 tomcat: max-threads: 50 - +mso: + infra: + auditInventory: true spring: datasource: driver-class-name: org.mariadb.jdbc.Driver diff --git a/bpmn/so-bpmn-building-blocks/pom.xml b/bpmn/so-bpmn-building-blocks/pom.xml index 4fe02ee3ac..0971a9d54e 100644 --- a/bpmn/so-bpmn-building-blocks/pom.xml +++ b/bpmn/so-bpmn-building-blocks/pom.xml @@ -147,6 +147,7 @@ <artifactId>mariaDB4j</artifactId> <version>2.2.3</version> <scope>test</scope> - </dependency> + </dependency> + </dependencies> </project> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn index ef19e6e35b..fd24be100b 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn @@ -1,15 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1"> <bpmn:process id="ActivateVfModuleBB" name="ActivateVfModuleBB" isExecutable="true"> <bpmn:startEvent id="ActivateVfModuleBB_Start"> <bpmn:outgoing>SequenceFlow_0ieafii</bpmn:outgoing> </bpmn:startEvent> - <bpmn:sequenceFlow id="SequenceFlow_0ieafii" sourceRef="ActivateVfModuleBB_Start" targetRef="ActivateVfModule" /> + <bpmn:sequenceFlow id="SequenceFlow_0ieafii" sourceRef="ActivateVfModuleBB_Start" targetRef="CheckAuditVariable" /> <bpmn:endEvent id="ActivateVfModuleBB_End"> <bpmn:incoming>SequenceFlow_0xsp0pv</bpmn:incoming> </bpmn:endEvent> <bpmn:serviceTask id="ActivateVfModule" name=" SDNC Activate (vf module) " camunda:expression="${SDNCActivateTasks.activateVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_0ieafii</bpmn:incoming> + <bpmn:incoming>SequenceFlow_07ybdik</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0ee42yq</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1a495wm</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="UpdateVfModuleActiveStatus" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActivateVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> @@ -29,57 +30,161 @@ </bpmn:callActivity> <bpmn:sequenceFlow id="SequenceFlow_1a495wm" sourceRef="ActivateVfModule" targetRef="CallActivity_sdncHandler" /> <bpmn:sequenceFlow id="SequenceFlow_1j4x1ej" sourceRef="CallActivity_sdncHandler" targetRef="UpdateVfModuleActiveStatus" /> + <bpmn:sequenceFlow id="SequenceFlow_0xndboi" sourceRef="Setup_AAI_Inventory_Audit" targetRef="Audit_AAI_Inventory" /> + <bpmn:serviceTask id="Setup_AAI_Inventory_Audit" name="Setup Inventory Audit Variable" camunda:expression="${AuditTasks.setupAuditVariable(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0ghzwlo</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0xndboi</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="Audit_AAI_Inventory" name="Validate A&AI Inventory" camunda:type="external" camunda:topic="InventoryAudit"> + <bpmn:incoming>SequenceFlow_0xndboi</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ee42yq</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:boundaryEvent id="BoundaryEvent_1nb1hw4" attachedToRef="Audit_AAI_Inventory"> + <bpmn:outgoing>SequenceFlow_1t99ceh</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:boundaryEvent> + <bpmn:sequenceFlow id="SequenceFlow_1t99ceh" sourceRef="BoundaryEvent_1nb1hw4" targetRef="Task_0swpw3v" /> + <bpmn:serviceTask id="Task_0swpw3v" name="Throw Exception" camunda:expression="${ExceptionBuilder.buildAndThrowWorkflowException(execution, "AuditAAIInventoryFailure", "Error Auditing Cloud Inventory in A&AI")}" camunda:resultVariable="ExceptionBuilder"> + <bpmn:incoming>SequenceFlow_1t99ceh</bpmn:incoming> + </bpmn:serviceTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_1v8bmbu" default="SequenceFlow_07ybdik"> + <bpmn:incoming>SequenceFlow_1xqyur9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_07ybdik</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0ghzwlo</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_07ybdik" sourceRef="ExclusiveGateway_1v8bmbu" targetRef="ActivateVfModule" /> + <bpmn:sequenceFlow id="SequenceFlow_0ghzwlo" sourceRef="ExclusiveGateway_1v8bmbu" targetRef="Setup_AAI_Inventory_Audit"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditInventoryNeeded").equals("true")}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0ee42yq" sourceRef="Audit_AAI_Inventory" targetRef="ActivateVfModule" /> + <bpmn:serviceTask id="CheckAuditVariable" name="Check Audit Variable" camunda:expression="${AuditTasks.isAuditNeeded(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0ieafii</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1xqyur9</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_1xqyur9" sourceRef="CheckAuditVariable" targetRef="ExclusiveGateway_1v8bmbu" /> </bpmn:process> - <bpmn:error id="Error_0q258vt" name="gDelegateError" errorCode="7000" /> + <bpmn:error id="Error_0q258vt" errorCode="7000" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateVfModuleBB"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="ActivateVfModuleBB_Start"> - <dc:Bounds x="173" y="102" width="36" height="36" /> + <dc:Bounds x="73" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="179" y="138" width="24" height="12" /> + <dc:Bounds x="46" y="138" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ieafii_di" bpmnElement="SequenceFlow_0ieafii"> - <di:waypoint xsi:type="dc:Point" x="209" y="120" /> - <di:waypoint xsi:type="dc:Point" x="262" y="120" /> + <di:waypoint xsi:type="dc:Point" x="109" y="120" /> + <di:waypoint xsi:type="dc:Point" x="161" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="190.5" y="99" width="90" height="12" /> + <dc:Bounds x="90" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1v967li_di" bpmnElement="ActivateVfModuleBB_End"> - <dc:Bounds x="736" y="102" width="36" height="36" /> + <dc:Bounds x="1104" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="710" y="142" width="90" height="12" /> + <dc:Bounds x="935" y="142" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0hawa84_di" bpmnElement="ActivateVfModule"> - <dc:Bounds x="262" y="80" width="100" height="80" /> + <dc:Bounds x="539" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_175e9ul_di" bpmnElement="UpdateVfModuleActiveStatus"> - <dc:Bounds x="600" y="80" width="100" height="80" /> + <dc:Bounds x="952" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0xsp0pv_di" bpmnElement="SequenceFlow_0xsp0pv"> - <di:waypoint xsi:type="dc:Point" x="700" y="120" /> - <di:waypoint xsi:type="dc:Point" x="736" y="120" /> + <di:waypoint xsi:type="dc:Point" x="1052" y="120" /> + <di:waypoint xsi:type="dc:Point" x="1104" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="673" y="99" width="90" height="12" /> + <dc:Bounds x="1033" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_03jkesd_di" bpmnElement="CallActivity_sdncHandler"> - <dc:Bounds x="420" y="80" width="100" height="80" /> + <dc:Bounds x="794" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1a495wm_di" bpmnElement="SequenceFlow_1a495wm"> - <di:waypoint xsi:type="dc:Point" x="362" y="120" /> - <di:waypoint xsi:type="dc:Point" x="420" y="120" /> + <di:waypoint xsi:type="dc:Point" x="639" y="120" /> + <di:waypoint xsi:type="dc:Point" x="794" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="391" y="99" width="0" height="12" /> + <dc:Bounds x="671.5" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1j4x1ej_di" bpmnElement="SequenceFlow_1j4x1ej"> - <di:waypoint xsi:type="dc:Point" x="520" y="120" /> - <di:waypoint xsi:type="dc:Point" x="600" y="120" /> + <di:waypoint xsi:type="dc:Point" x="894" y="120" /> + <di:waypoint xsi:type="dc:Point" x="952" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="878" y="99" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0xndboi_di" bpmnElement="SequenceFlow_0xndboi"> + <di:waypoint xsi:type="dc:Point" x="365" y="256" /> + <di:waypoint xsi:type="dc:Point" x="452" y="256" /> + <di:waypoint xsi:type="dc:Point" x="452" y="256" /> + <di:waypoint xsi:type="dc:Point" x="539" y="256" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="422" y="249.5" width="90" height="13" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0krf1ur_di" bpmnElement="Setup_AAI_Inventory_Audit"> + <dc:Bounds x="265" y="216" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_08rxjeb_di" bpmnElement="Audit_AAI_Inventory"> + <dc:Bounds x="539" y="216" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BoundaryEvent_0s7rszu_di" bpmnElement="BoundaryEvent_1nb1hw4"> + <dc:Bounds x="575" y="278" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="548" y="317" width="90" height="13" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1t99ceh_di" bpmnElement="SequenceFlow_1t99ceh"> + <di:waypoint xsi:type="dc:Point" x="593" y="314" /> + <di:waypoint xsi:type="dc:Point" x="593" y="348" /> + <di:waypoint xsi:type="dc:Point" x="593" y="348" /> + <di:waypoint xsi:type="dc:Point" x="593" y="371" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="563" y="341.5" width="90" height="13" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0eujimg_di" bpmnElement="Task_0swpw3v"> + <dc:Bounds x="543" y="371" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1v8bmbu_di" bpmnElement="ExclusiveGateway_1v8bmbu" isMarkerVisible="true"> + <dc:Bounds x="290" y="95" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="315" y="148" width="0" height="13" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_07ybdik_di" bpmnElement="SequenceFlow_07ybdik"> + <di:waypoint xsi:type="dc:Point" x="340" y="120" /> + <di:waypoint xsi:type="dc:Point" x="539" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="439.5" y="98.5" width="0" height="13" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ghzwlo_di" bpmnElement="SequenceFlow_0ghzwlo"> + <di:waypoint xsi:type="dc:Point" x="315" y="145" /> + <di:waypoint xsi:type="dc:Point" x="315" y="216" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="330" y="174" width="0" height="13" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ee42yq_di" bpmnElement="SequenceFlow_0ee42yq"> + <di:waypoint xsi:type="dc:Point" x="589" y="216" /> + <di:waypoint xsi:type="dc:Point" x="589" y="193" /> + <di:waypoint xsi:type="dc:Point" x="589" y="193" /> + <di:waypoint xsi:type="dc:Point" x="589" y="160" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="604" y="186.5" width="0" height="13" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1eg5ryx_di" bpmnElement="CheckAuditVariable"> + <dc:Bounds x="161" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1xqyur9_di" bpmnElement="SequenceFlow_1xqyur9"> + <di:waypoint xsi:type="dc:Point" x="261" y="120" /> + <di:waypoint xsi:type="dc:Point" x="290" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="560" y="99" width="0" height="12" /> + <dc:Bounds x="275.5" y="98.5" width="0" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn index bd126de24e..97fad57e7d 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> <bpmn:process id="CreateVfModuleBB" name="CreateVfModuleBB" isExecutable="true"> <bpmn:startEvent id="CreateVfModuleBB_Start"> <bpmn:outgoing>SequenceFlow_1xr6chl</bpmn:outgoing> @@ -10,7 +10,7 @@ </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1xr6chl" sourceRef="CreateVfModuleBB_Start" targetRef="QueryVnf" /> <bpmn:endEvent id="CreateVfModuleBB_End"> - <bpmn:incoming>SequenceFlow_1stomxq</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1vbwdaw</bpmn:incoming> </bpmn:endEvent> <bpmn:serviceTask id="CreateVfModule" name="Create VF Module (VNF)" camunda:expression="${VnfAdapterCreateTasks.createVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_15hn8si</bpmn:incoming> @@ -23,26 +23,28 @@ <bpmn:outgoing>SequenceFlow_1s4rpyp</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_16g4dz0" sourceRef="CreateVfModule" targetRef="VnfAdapter" /> - <bpmn:sequenceFlow id="SequenceFlow_0ecr393" sourceRef="VnfAdapter" targetRef="UpdateVfModuleHeatStackId" /> + <bpmn:sequenceFlow id="SequenceFlow_0ecr393" sourceRef="VnfAdapter" targetRef="CreateNetworkPolicies" /> <bpmn:callActivity id="VnfAdapter" name="Vnf Adapter" calledElement="VnfAdapter"> <bpmn:extensionElements> <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" /> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:in source="VNFREST_Request" target="VNFREST_Request" /> <camunda:out source="heatStackId" target="heatStackId" /> + <camunda:out source="contrailServiceInstanceFqdn" target="contrailServiceInstanceFqdn" /> + <camunda:out source="oamManagementV4Address" target="oamManagementV4Address" /> + <camunda:out source="oamManagementV6Address" target="oamManagementV6Address" /> + <camunda:out source="contrailNetworkPolicyFqdnList" target="contrailNetworkPolicyFqdnList" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_16g4dz0</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0ecr393</bpmn:outgoing> </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_1stomxq" sourceRef="UpdateVfModuleStatus" targetRef="CreateVfModuleBB_End" /> <bpmn:serviceTask id="UpdateVfModuleStatus" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusCreatedVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_0qqsilv</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1stomxq</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_0rds4rj</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1vbwdaw</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_0qqsilv" sourceRef="UpdateVfModuleHeatStackId" targetRef="UpdateVfModuleStatus" /> <bpmn:serviceTask id="UpdateVfModuleHeatStackId" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateHeatStackIdVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_0ecr393</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0qqsilv</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_15do1tu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0rds4rj</bpmn:outgoing> </bpmn:serviceTask> <bpmn:subProcess id="SubProcess_1getwnf" name="Error Handling " triggeredByEvent="true"> <bpmn:startEvent id="StartEvent_1c8o652"> @@ -55,29 +57,51 @@ </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_0gcots6" sourceRef="StartEvent_1c8o652" targetRef="EndEvent_1emam1w" /> </bpmn:subProcess> + <bpmn:sequenceFlow id="SequenceFlow_0rds4rj" sourceRef="UpdateVfModuleHeatStackId" targetRef="UpdateVfModuleStatus" /> + <bpmn:sequenceFlow id="SequenceFlow_1vbwdaw" sourceRef="UpdateVfModuleStatus" targetRef="CreateVfModuleBB_End" /> + <bpmn:serviceTask id="CreateNetworkPolicies" name="AAI Create (network policies)" camunda:expression="${AAICreateTasks.createNetworkPolicies(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0ecr393</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0xqhep5</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0xqhep5" sourceRef="CreateNetworkPolicies" targetRef="UpdateVnfIpv4OamAddress" /> + <bpmn:serviceTask id="UpdateVnfIpv4OamAddress" name="AAI Update (VNF)Â " camunda:expression="${AAIUpdateTasks.updateIpv4OamAddressVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0xqhep5</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1yo6mvv</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_1yo6mvv" sourceRef="UpdateVnfIpv4OamAddress" targetRef="UpdateVnfManagementV6Address" /> + <bpmn:serviceTask id="UpdateVnfManagementV6Address" name="AAI Update (VNF)" camunda:expression="${AAIUpdateTasks.updateManagementV6AddressVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_1yo6mvv</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1i03uy2</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_1i03uy2" sourceRef="UpdateVnfManagementV6Address" targetRef="UpdateVfModuleContrailServiceInstanceFqdn" /> + <bpmn:serviceTask id="UpdateVfModuleContrailServiceInstanceFqdn" name="AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateContrailServiceInstanceFqdnVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_1i03uy2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15do1tu</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_15do1tu" sourceRef="UpdateVfModuleContrailServiceInstanceFqdn" targetRef="UpdateVfModuleHeatStackId" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateVfModuleBB"> <bpmndi:BPMNShape id="StartEvent_0kxwniy_di" bpmnElement="CreateVfModuleBB_Start"> - <dc:Bounds x="100" y="88" width="36" height="36" /> + <dc:Bounds x="59" y="88" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="106" y="124" width="24" height="12" /> + <dc:Bounds x="77" y="124" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_13t22km_di" bpmnElement="QueryVfModule"> <dc:Bounds x="416" y="66" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1xr6chl_di" bpmnElement="SequenceFlow_1xr6chl"> - <di:waypoint xsi:type="dc:Point" x="136" y="106" /> + <di:waypoint xsi:type="dc:Point" x="95" y="106" /> <di:waypoint xsi:type="dc:Point" x="216" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="131" y="91" width="90" height="0" /> + <dc:Bounds x="156" y="91" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_0qdq7wj_di" bpmnElement="CreateVfModuleBB_End"> - <dc:Bounds x="1278" y="88" width="36" height="36" /> + <dc:Bounds x="1118" y="293" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1286" y="128" width="19" height="12" /> + <dc:Bounds x="1136" y="333" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1dgenhy_di" bpmnElement="CreateVfModule"> @@ -102,61 +126,107 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_16g4dz0_di" bpmnElement="SequenceFlow_16g4dz0"> <di:waypoint xsi:type="dc:Point" x="712" y="106" /> - <di:waypoint xsi:type="dc:Point" x="777" y="106" /> + <di:waypoint xsi:type="dc:Point" x="790" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="700" y="85" width="90" height="12" /> + <dc:Bounds x="751" y="91" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0ecr393_di" bpmnElement="SequenceFlow_0ecr393"> - <di:waypoint xsi:type="dc:Point" x="877" y="106" /> - <di:waypoint xsi:type="dc:Point" x="950" y="106" /> + <di:waypoint xsi:type="dc:Point" x="890" y="107" /> + <di:waypoint xsi:type="dc:Point" x="994" y="107" /> + <di:waypoint xsi:type="dc:Point" x="994" y="209" /> + <di:waypoint xsi:type="dc:Point" x="73" y="209" /> + <di:waypoint xsi:type="dc:Point" x="73" y="306" /> + <di:waypoint xsi:type="dc:Point" x="142" y="306" /> <bpmndi:BPMNLabel> - <dc:Bounds x="869" y="91" width="90" height="0" /> + <dc:Bounds x="534" y="194" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_1i1pfzb_di" bpmnElement="VnfAdapter"> - <dc:Bounds x="777" y="66" width="100" height="80" /> + <dc:Bounds x="790" y="66" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1stomxq_di" bpmnElement="SequenceFlow_1stomxq"> - <di:waypoint xsi:type="dc:Point" x="1214" y="106" /> - <di:waypoint xsi:type="dc:Point" x="1278" y="106" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1201" y="91" width="90" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0fpfn71_di" bpmnElement="UpdateVfModuleStatus"> - <dc:Bounds x="1114" y="66" width="100" height="80" /> + <dc:Bounds x="942" y="271" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0qqsilv_di" bpmnElement="SequenceFlow_0qqsilv"> - <di:waypoint xsi:type="dc:Point" x="1050" y="106" /> - <di:waypoint xsi:type="dc:Point" x="1114" y="106" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1037" y="91" width="90" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_04k1b85_di" bpmnElement="UpdateVfModuleHeatStackId"> - <dc:Bounds x="950" y="66" width="100" height="80" /> + <dc:Bounds x="777" y="271" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_1getwnf_di" bpmnElement="SubProcess_1getwnf" isExpanded="true"> - <dc:Bounds x="172" y="276" width="231" height="135" /> + <dc:Bounds x="136" y="439" width="231" height="135" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_1c8o652_di" bpmnElement="StartEvent_1c8o652"> - <dc:Bounds x="211" y="334" width="36" height="36" /> + <dc:Bounds x="175" y="497" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="184" y="370" width="0" height="12" /> + <dc:Bounds x="148" y="533" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1emam1w_di" bpmnElement="EndEvent_1emam1w"> - <dc:Bounds x="348" y="334" width="36" height="36" /> + <dc:Bounds x="312" y="497" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="321" y="370" width="0" height="12" /> + <dc:Bounds x="285" y="533" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0gcots6_di" bpmnElement="SequenceFlow_0gcots6"> - <di:waypoint xsi:type="dc:Point" x="247" y="352" /> - <di:waypoint xsi:type="dc:Point" x="348" y="352" /> + <di:waypoint xsi:type="dc:Point" x="211" y="515" /> + <di:waypoint xsi:type="dc:Point" x="312" y="515" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="262" y="494" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0rds4rj_di" bpmnElement="SequenceFlow_0rds4rj"> + <di:waypoint xsi:type="dc:Point" x="877" y="311" /> + <di:waypoint xsi:type="dc:Point" x="942" y="311" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="910" y="296" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1vbwdaw_di" bpmnElement="SequenceFlow_1vbwdaw"> + <di:waypoint xsi:type="dc:Point" x="1042" y="311" /> + <di:waypoint xsi:type="dc:Point" x="1083" y="311" /> + <di:waypoint xsi:type="dc:Point" x="1083" y="311" /> + <di:waypoint xsi:type="dc:Point" x="1118" y="311" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1098" y="311" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1v8zx4s_di" bpmnElement="CreateNetworkPolicies"> + <dc:Bounds x="142" y="271" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0xqhep5_di" bpmnElement="SequenceFlow_0xqhep5"> + <di:waypoint xsi:type="dc:Point" x="242" y="311" /> + <di:waypoint xsi:type="dc:Point" x="295" y="311" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="269" y="296" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_015ayw5_di" bpmnElement="UpdateVnfIpv4OamAddress"> + <dc:Bounds x="295" y="271" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1yo6mvv_di" bpmnElement="SequenceFlow_1yo6mvv"> + <di:waypoint xsi:type="dc:Point" x="395" y="311" /> + <di:waypoint xsi:type="dc:Point" x="464" y="311" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="430" y="296" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0mlfsc9_di" bpmnElement="UpdateVnfManagementV6Address"> + <dc:Bounds x="464" y="271" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1i03uy2_di" bpmnElement="SequenceFlow_1i03uy2"> + <di:waypoint xsi:type="dc:Point" x="564" y="311" /> + <di:waypoint xsi:type="dc:Point" x="612" y="311" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="588" y="296" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0wctnhw_di" bpmnElement="UpdateVfModuleContrailServiceInstanceFqdn"> + <dc:Bounds x="612" y="271" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_15do1tu_di" bpmnElement="SequenceFlow_15do1tu"> + <di:waypoint xsi:type="dc:Point" x="712" y="311" /> + <di:waypoint xsi:type="dc:Point" x="777" y="311" /> <bpmndi:BPMNLabel> - <dc:Bounds x="297.5" y="331" width="0" height="12" /> + <dc:Bounds x="745" y="286" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn index 5cf41b655b..804ae70c58 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn @@ -24,11 +24,15 @@ <camunda:in source="deleteVfModuleRequest" target="deleteVfModuleRequest" /> <camunda:in source="VNFREST_Request" target="VNFREST_Request" /> <camunda:out source="heatStackId" target="heatStackId" /> + <camunda:out source="oamManagementV4Address" target="oamManagementV4Address" /> + <camunda:out source="oamManagementV6Address" target="oamManagementV6Address" /> + <camunda:out source="contrailNetworkPolicyFqdnList" target="contrailNetworkPolicyFqdnList" /> + <camunda:out source="contrailServiceInstanceFqdn" target="contrailServiceInstanceFqdn" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_08tvhtf</bpmn:incoming> <bpmn:outgoing>SequenceFlow_02lpx87</bpmn:outgoing> </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_02lpx87" sourceRef="VnfAdapter" targetRef="UpdateVfModuleHeatStackId" /> + <bpmn:sequenceFlow id="SequenceFlow_02lpx87" sourceRef="VnfAdapter" targetRef="DeleteNetworkPolicies" /> <bpmn:subProcess id="SubProcess_11p7mrh" name="Error Handling " triggeredByEvent="true"> <bpmn:startEvent id="StartEvent_1xp6ewt"> <bpmn:outgoing>SequenceFlow_0h607z0</bpmn:outgoing> @@ -41,11 +45,31 @@ <bpmn:sequenceFlow id="SequenceFlow_0h607z0" sourceRef="StartEvent_1xp6ewt" targetRef="EndEvent_0guhjau" /> </bpmn:subProcess> <bpmn:serviceTask id="UpdateVfModuleHeatStackId" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateHeatStackIdVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_02lpx87</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0yuz21z</bpmn:incoming> <bpmn:outgoing>SequenceFlow_01vfwtp</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_01vfwtp" sourceRef="UpdateVfModuleHeatStackId" targetRef="UpdateVfModuleDeleteStatus" /> <bpmn:sequenceFlow id="SequenceFlow_09l7pcg" sourceRef="UpdateVfModuleDeleteStatus" targetRef="DeleteVfModuleBB_End" /> + <bpmn:sequenceFlow id="SequenceFlow_0xyu3pk" sourceRef="DeleteNetworkPolicies" targetRef="UpdateVnfIpv4OamAddress" /> + <bpmn:serviceTask id="DeleteNetworkPolicies" name="AAI Delete (network policies)" camunda:expression="${AAIDeleteTasks.deleteNetworkPolicies(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_02lpx87</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0xyu3pk</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="UpdateVnfManagementV6Address" name="AAI Update (VNF)" camunda:expression="${AAIUpdateTasks.updateManagementV6AddressVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0jtem3b</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0khqfnc</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0jtem3b" sourceRef="UpdateVnfIpv4OamAddress" targetRef="UpdateVnfManagementV6Address" /> + <bpmn:serviceTask id="UpdateVnfIpv4OamAddress" name="AAI Update (VNF)" camunda:expression="${AAIUpdateTasks.updateIpv4OamAddressVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0xyu3pk</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0jtem3b</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0khqfnc" sourceRef="UpdateVnfManagementV6Address" targetRef="UpdateVfModuleContrailServiceInstanceFqdn" /> + <bpmn:sequenceFlow id="SequenceFlow_0yuz21z" sourceRef="UpdateVfModuleContrailServiceInstanceFqdn" targetRef="UpdateVfModuleHeatStackId" /> + <bpmn:serviceTask id="UpdateVfModuleContrailServiceInstanceFqdn" name="AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateContrailServiceInstanceFqdnVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0khqfnc</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0yuz21z</bpmn:outgoing> + </bpmn:serviceTask> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteVfModuleBB"> @@ -66,7 +90,7 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0pbhsub_di" bpmnElement="UpdateVfModuleDeleteStatus"> - <dc:Bounds x="762" y="80" width="100" height="80" /> + <dc:Bounds x="758" y="243" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_08tvhtf_di" bpmnElement="SequenceFlow_08tvhtf"> <di:waypoint xsi:type="dc:Point" x="361" y="120" /> @@ -76,9 +100,9 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1rn6yvh_di" bpmnElement="DeleteVfModuleBB_End"> - <dc:Bounds x="922" y="102" width="36" height="36" /> + <dc:Bounds x="918" y="265" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="940" y="142" width="0" height="0" /> + <dc:Bounds x="936" y="305" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0whogn3_di" bpmnElement="VnfAdapter"> @@ -86,50 +110,94 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_02lpx87_di" bpmnElement="SequenceFlow_02lpx87"> <di:waypoint xsi:type="dc:Point" x="527" y="120" /> - <di:waypoint xsi:type="dc:Point" x="604" y="120" /> + <di:waypoint xsi:type="dc:Point" x="591" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="566" y="105" width="0" height="0" /> + <dc:Bounds x="559" y="105" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_11p7mrh_di" bpmnElement="SubProcess_11p7mrh" isExpanded="true"> - <dc:Bounds x="261" y="276" width="231" height="135" /> + <dc:Bounds x="295" y="412" width="231" height="135" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_1xp6ewt_di" bpmnElement="StartEvent_1xp6ewt"> - <dc:Bounds x="304" y="338" width="36" height="36" /> + <dc:Bounds x="338" y="474" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="277" y="374" width="0" height="12" /> + <dc:Bounds x="311" y="510" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0guhjau_di" bpmnElement="EndEvent_0guhjau"> - <dc:Bounds x="433" y="338" width="36" height="36" /> + <dc:Bounds x="467" y="474" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="406" y="374" width="0" height="12" /> + <dc:Bounds x="440" y="510" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0h607z0_di" bpmnElement="SequenceFlow_0h607z0"> - <di:waypoint xsi:type="dc:Point" x="340" y="356" /> - <di:waypoint xsi:type="dc:Point" x="433" y="356" /> + <di:waypoint xsi:type="dc:Point" x="374" y="492" /> + <di:waypoint xsi:type="dc:Point" x="467" y="492" /> <bpmndi:BPMNLabel> - <dc:Bounds x="386.5" y="335" width="0" height="12" /> + <dc:Bounds x="421" y="471" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0vlgqod_di" bpmnElement="UpdateVfModuleHeatStackId"> - <dc:Bounds x="604" y="80" width="100" height="80" /> + <dc:Bounds x="591" y="243" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_01vfwtp_di" bpmnElement="SequenceFlow_01vfwtp"> - <di:waypoint xsi:type="dc:Point" x="704" y="120" /> - <di:waypoint xsi:type="dc:Point" x="762" y="120" /> + <di:waypoint xsi:type="dc:Point" x="691" y="283" /> + <di:waypoint xsi:type="dc:Point" x="758" y="283" /> <bpmndi:BPMNLabel> - <dc:Bounds x="733" y="95" width="0" height="0" /> + <dc:Bounds x="725" y="268" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_09l7pcg_di" bpmnElement="SequenceFlow_09l7pcg"> - <di:waypoint xsi:type="dc:Point" x="862" y="120" /> - <di:waypoint xsi:type="dc:Point" x="922" y="120" /> + <di:waypoint xsi:type="dc:Point" x="858" y="283" /> + <di:waypoint xsi:type="dc:Point" x="918" y="283" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="888" y="258" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0xyu3pk_di" bpmnElement="SequenceFlow_0xyu3pk"> + <di:waypoint xsi:type="dc:Point" x="691" y="120" /> + <di:waypoint xsi:type="dc:Point" x="751" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="721" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0tty0ac_di" bpmnElement="DeleteNetworkPolicies"> + <dc:Bounds x="591" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0lrrd16_di" bpmnElement="UpdateVnfManagementV6Address"> + <dc:Bounds x="261" y="243" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0jtem3b_di" bpmnElement="SequenceFlow_0jtem3b"> + <di:waypoint xsi:type="dc:Point" x="851" y="120" /> + <di:waypoint xsi:type="dc:Point" x="941" y="120" /> + <di:waypoint xsi:type="dc:Point" x="941" y="205" /> + <di:waypoint xsi:type="dc:Point" x="182" y="205" /> + <di:waypoint xsi:type="dc:Point" x="182" y="283" /> + <di:waypoint xsi:type="dc:Point" x="261" y="283" /> <bpmndi:BPMNLabel> - <dc:Bounds x="892" y="95" width="0" height="0" /> + <dc:Bounds x="562" y="190" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0w9805b_di" bpmnElement="UpdateVnfIpv4OamAddress"> + <dc:Bounds x="751" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0khqfnc_di" bpmnElement="SequenceFlow_0khqfnc"> + <di:waypoint xsi:type="dc:Point" x="361" y="283" /> + <di:waypoint xsi:type="dc:Point" x="427" y="283" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="394" y="268" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0yuz21z_di" bpmnElement="SequenceFlow_0yuz21z"> + <di:waypoint xsi:type="dc:Point" x="527" y="283" /> + <di:waypoint xsi:type="dc:Point" x="591" y="283" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="559" y="268" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0v8naz9_di" bpmnElement="UpdateVfModuleContrailServiceInstanceFqdn"> + <dc:Bounds x="427" y="243" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn index 9be4cd0473..5189f8b48a 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> <bpmn:process id="ExecuteBuildingBlock" name="ExecuteBuildingBlock" isExecutable="true"> <bpmn:startEvent id="Start_ExecuteBuildingBlock" name="start"> <bpmn:outgoing>SequenceFlow_0rq4c5r</bpmn:outgoing> @@ -37,7 +37,7 @@ <bpmn:subProcess id="SubProcess_0tv8zda" name="Error Handling " triggeredByEvent="true"> <bpmn:startEvent id="StartEvent_0tmcs9g"> <bpmn:outgoing>SequenceFlow_09synl9</bpmn:outgoing> - <bpmn:errorEventDefinition /> + <bpmn:errorEventDefinition camunda:errorCodeVariable="WorkflowExceptionCode" camunda:errorMessageVariable="WorkflowExceptionMessage" /> </bpmn:startEvent> <bpmn:sequenceFlow id="SequenceFlow_09synl9" sourceRef="StartEvent_0tmcs9g" targetRef="Task_QueryRainyDayTable" /> <bpmn:serviceTask id="Task_QueryRainyDayTable" name="QueryRainyDayTable" camunda:expression="${ExecuteBuildingBlockRainyDay.queryRainyDayTable(execution,true)}"> @@ -73,7 +73,7 @@ <bpmn:sequenceFlow id="SequenceFlow_0ndt8ft" sourceRef="Task_SetRetryTimer" targetRef="IntermediateCatchEvent_RetryTimer" /> <bpmn:sequenceFlow id="SequenceFlow_07a1ytc" sourceRef="IntermediateCatchEvent_RetryTimer" targetRef="EndEvent_1sez2lh" /> <bpmn:sequenceFlow id="SequenceFlow_1wbevp0" name="yes" sourceRef="ExclusiveGateway_0ey4zpt" targetRef="Task_SetRetryTimer"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("retryCount")<5}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("retryCount")<execution.getVariable("maxRetries")}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:endEvent id="EndEvent_0mvmk3i"> <bpmn:incoming>SequenceFlow_0h8v45y</bpmn:incoming> @@ -114,6 +114,11 @@ </bpmn:process> <bpmn:error id="Error_0tnktdw" name="Error" errorCode="java.lang.Exception" /> <bpmn:error id="Error_17zcdbk" name="Bpmn Error" /> + <bpmn:error id="Error_123q3fr" name="Error_1h13m8l" /> + <bpmn:error id="Error_1ivyybb" name="Error_1e4p3cf" /> + <bpmn:error id="Error_1c60d7i" name="Error_0qrs661" /> + <bpmn:error id="Error_1owi18u" name="Error_2eiqdl7" /> + <bpmn:error id="Error_0snha16" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ExecuteBuildingBlock"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_ExecuteBuildingBlock"> @@ -156,63 +161,63 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_0ey4zpt_di" bpmnElement="ExclusiveGateway_0ey4zpt" isMarkerVisible="true"> - <dc:Bounds x="724" y="367" width="50" height="50" /> + <dc:Bounds x="721" y="385" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="719" y="342" width="62" height="12" /> + <dc:Bounds x="716" y="360" width="63" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateCatchEvent_0qjyidb_di" bpmnElement="IntermediateCatchEvent_RetryTimer"> - <dc:Bounds x="968" y="374" width="36" height="36" /> + <dc:Bounds x="965" y="392" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="959" y="349" width="55" height="12" /> + <dc:Bounds x="956" y="367" width="55" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1aonzik_di" bpmnElement="ExclusiveGateway_1aonzik" isMarkerVisible="true"> - <dc:Bounds x="571" y="367" width="50" height="50" /> + <dc:Bounds x="568" y="385" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="562" y="329" width="68" height="24" /> + <dc:Bounds x="558" y="347" width="70" height="25" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1wbevp0_di" bpmnElement="SequenceFlow_1wbevp0"> - <di:waypoint xsi:type="dc:Point" x="774" y="392" /> - <di:waypoint xsi:type="dc:Point" x="839" y="392" /> + <di:waypoint xsi:type="dc:Point" x="771" y="410" /> + <di:waypoint xsi:type="dc:Point" x="836" y="410" /> <bpmndi:BPMNLabel> - <dc:Bounds x="790.2777777777778" y="367" width="18" height="12" /> + <dc:Bounds x="788" y="385" width="18" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0fwsjva_di" bpmnElement="SequenceFlow_0fwsjva"> - <di:waypoint xsi:type="dc:Point" x="621" y="392" /> - <di:waypoint xsi:type="dc:Point" x="724" y="392" /> + <di:waypoint xsi:type="dc:Point" x="618" y="410" /> + <di:waypoint xsi:type="dc:Point" x="721" y="410" /> <bpmndi:BPMNLabel> - <dc:Bounds x="659" y="400" width="27" height="12" /> + <dc:Bounds x="656" y="418" width="27" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0h8v45y_di" bpmnElement="SequenceFlow_0h8v45y"> - <di:waypoint xsi:type="dc:Point" x="596" y="417" /> - <di:waypoint xsi:type="dc:Point" x="596" y="473" /> + <di:waypoint xsi:type="dc:Point" x="593" y="435" /> + <di:waypoint xsi:type="dc:Point" x="593" y="491" /> <bpmndi:BPMNLabel> - <dc:Bounds x="603" y="438" width="84" height="12" /> + <dc:Bounds x="600" y="456" width="85" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1tifgqh_di" bpmnElement="Task_QueryRainyDayTable"> - <dc:Bounds x="428" y="352" width="100" height="80" /> + <dc:Bounds x="425" y="370" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ndt8ft_di" bpmnElement="SequenceFlow_0ndt8ft"> - <di:waypoint xsi:type="dc:Point" x="939" y="392" /> - <di:waypoint xsi:type="dc:Point" x="968" y="392" /> + <di:waypoint xsi:type="dc:Point" x="936" y="410" /> + <di:waypoint xsi:type="dc:Point" x="965" y="410" /> <bpmndi:BPMNLabel> - <dc:Bounds x="908.5" y="371" width="90" height="12" /> + <dc:Bounds x="906" y="389" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_07a1ytc_di" bpmnElement="SequenceFlow_07a1ytc"> - <di:waypoint xsi:type="dc:Point" x="1004" y="392" /> - <di:waypoint xsi:type="dc:Point" x="1042" y="392" /> + <di:waypoint xsi:type="dc:Point" x="1001" y="410" /> + <di:waypoint xsi:type="dc:Point" x="1039" y="410" /> <bpmndi:BPMNLabel> - <dc:Bounds x="978" y="371" width="90" height="12" /> + <dc:Bounds x="975" y="389" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1obvxht_di" bpmnElement="Task_SetRetryTimer"> - <dc:Bounds x="839" y="352" width="100" height="80" /> + <dc:Bounds x="836" y="370" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0kdjsnx_di" bpmnElement="Continue"> <di:waypoint xsi:type="dc:Point" x="508" y="180" /> @@ -238,38 +243,38 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0a62t4c_di" bpmnElement="SequenceFlow_0a62t4c"> - <di:waypoint xsi:type="dc:Point" x="528" y="392" /> - <di:waypoint xsi:type="dc:Point" x="571" y="392" /> + <di:waypoint xsi:type="dc:Point" x="525" y="410" /> + <di:waypoint xsi:type="dc:Point" x="568" y="410" /> <bpmndi:BPMNLabel> - <dc:Bounds x="505" y="371" width="90" height="13" /> + <dc:Bounds x="502" y="389" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_0tv8zda_di" bpmnElement="SubProcess_0tv8zda" isExpanded="true"> - <dc:Bounds x="323" y="276" width="802" height="290" /> + <dc:Bounds x="320" y="294" width="802" height="290" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_0tmcs9g_di" bpmnElement="StartEvent_0tmcs9g"> - <dc:Bounds x="343" y="374" width="36" height="36" /> + <dc:Bounds x="340" y="392" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="226" y="410" width="90" height="12" /> + <dc:Bounds x="223" y="428" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_09synl9_di" bpmnElement="SequenceFlow_09synl9"> - <di:waypoint xsi:type="dc:Point" x="379" y="392" /> - <di:waypoint xsi:type="dc:Point" x="428" y="392" /> + <di:waypoint xsi:type="dc:Point" x="376" y="410" /> + <di:waypoint xsi:type="dc:Point" x="425" y="410" /> <bpmndi:BPMNLabel> - <dc:Bounds x="359" y="371" width="90" height="12" /> + <dc:Bounds x="356" y="389" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_0mvmk3i_di" bpmnElement="EndEvent_0mvmk3i"> - <dc:Bounds x="578" y="473" width="36" height="36" /> + <dc:Bounds x="575" y="491" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="551" y="513" width="90" height="12" /> + <dc:Bounds x="548" y="531" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1aww7yx_di" bpmnElement="EndEvent_1sez2lh"> - <dc:Bounds x="1042" y="374" width="36" height="36" /> + <dc:Bounds x="1039" y="392" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1052" y="414" width="18" height="12" /> + <dc:Bounds x="1049" y="432" width="19" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_16lmcxp_di" bpmnElement="SequenceFlow_16lmcxp"> @@ -312,27 +317,27 @@ <dc:Bounds x="906" y="140" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0541bid_di" bpmnElement="SequenceFlow_0541bid"> - <di:waypoint xsi:type="dc:Point" x="749" y="417" /> - <di:waypoint xsi:type="dc:Point" x="749" y="441" /> + <di:waypoint xsi:type="dc:Point" x="746" y="435" /> + <di:waypoint xsi:type="dc:Point" x="746" y="459" /> <bpmndi:BPMNLabel> - <dc:Bounds x="760" y="418" width="12" height="12" /> + <dc:Bounds x="757" y="436" width="13" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_12ps9at_di" bpmnElement="SequenceFlow_12ps9at"> - <di:waypoint xsi:type="dc:Point" x="799" y="481" /> - <di:waypoint xsi:type="dc:Point" x="871" y="481" /> + <di:waypoint xsi:type="dc:Point" x="796" y="499" /> + <di:waypoint xsi:type="dc:Point" x="868" y="499" /> <bpmndi:BPMNLabel> - <dc:Bounds x="835" y="460" width="0" height="12" /> + <dc:Bounds x="787" y="478" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_05vw85n_di" bpmnElement="EndEvent_0ex9298"> - <dc:Bounds x="871" y="463" width="36" height="36" /> + <dc:Bounds x="868" y="481" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="880" y="503" width="18" height="12" /> + <dc:Bounds x="877" y="521" width="19" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_11f2c91_di" bpmnElement="Task_QuerySecondaryPolicy"> - <dc:Bounds x="699" y="441" width="100" height="80" /> + <dc:Bounds x="696" y="459" width="100" height="80" /> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn index 70ae02b0fe..81d3226037 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn @@ -22,7 +22,6 @@ <camunda:out source="orchestrationStatusValidationResult" target="orchestrationStatusValidationResult" /> <camunda:out source="RetryDuration" target="RetryDuration" /> <camunda:in source="suppressRollback" target="suppressRollback" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0mew9im</bpmn:incoming> <bpmn:outgoing>SequenceFlow_07h9d4y</bpmn:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java index 1e3f175cf1..79bade3cf3 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java @@ -23,7 +23,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; - +import org.camunda.bpm.engine.ExternalTaskService; import org.camunda.bpm.engine.RepositoryService; import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.extension.mockito.mock.FluentJavaDelegateMock; @@ -50,6 +50,8 @@ import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterCreateTasks; import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterDeleteTasks; import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterImpl; import org.onap.so.bpmn.infrastructure.appc.tasks.AppcRunTasks; +import org.onap.so.bpmn.infrastructure.audit.AuditTasks; +import org.onap.so.bpmn.infrastructure.flowspecific.tasks.ActivateVfModule; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetwork; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignVnf; @@ -93,6 +95,9 @@ public abstract class BaseBPMNTest { protected RuntimeService runtimeService; @Autowired + protected ExternalTaskService externalTaskService; + + @Autowired private RepositoryService repositoryService; protected Map<String, Object> variables = new HashMap<>(); @@ -171,6 +176,9 @@ public abstract class BaseBPMNTest { protected AAICommonTasks aaiCommonTasks; @MockBean + protected ActivateVfModule activateVfModule; + + @MockBean protected AssignVnf assignVnf; @MockBean @@ -223,6 +231,9 @@ public abstract class BaseBPMNTest { @MockBean protected WorkflowActionBBFailure workflowActionBBFailure; + + @MockBean + protected AuditTasks auditTasks; @LocalServerPort protected int port; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java index 2c2777154d..9ffcd9d77a 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java @@ -21,23 +21,43 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; - import java.io.IOException; +import java.util.List; import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.externaltask.LockedExternalTask; import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Before; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; public class ActivateVfModuleBBTest extends BaseBPMNTest{ + + @Before + public void before() { + variables.put("vfModuleActivateTimerDuration", "PT2S"); + variables.put("auditInventoryNeeded", "true"); + } + @Test public void sunnyDay() throws InterruptedException, IOException { mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables); + List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") + .topic("InventoryAudit", 60L * 1000L).execute(); + while (!tasks.isEmpty()) { + for (LockedExternalTask task : tasks) { + externalTaskService.complete(task.getId(), "externalWorkerId"); + } + tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") + .topic("InventoryAudit", 60L * 1000L).execute(); + } + assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("ActivateVfModuleBB_Start", "ActivateVfModule", "CallActivity_sdncHandler", + assertThat(pi).isStarted().hasPassedInOrder("ActivateVfModuleBB_Start","ExclusiveGateway_1v8bmbu","Setup_AAI_Inventory_Audit", "Audit_AAI_Inventory", "ActivateVfModule", "CallActivity_sdncHandler", "UpdateVfModuleActiveStatus", "ActivateVfModuleBB_End"); assertThat(pi).isEnded(); } @@ -47,8 +67,18 @@ public class ActivateVfModuleBBTest extends BaseBPMNTest{ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); doThrow(BpmnError.class).when(aaiUpdateTasks).updateOrchestrationStatusActivateVfModule(any(BuildingBlockExecution.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables); + List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") + .topic("InventoryAudit", 60L * 1000L).execute(); + while (!tasks.isEmpty()) { + for (LockedExternalTask task : tasks) { + externalTaskService.complete(task.getId(), "externalWorkerId"); + } + tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") + .topic("InventoryAudit", 60L * 1000L).execute(); + } + assertThat(pi).isNotNull().isStarted() - .hasPassedInOrder("ActivateVfModuleBB_Start", "ActivateVfModule", "UpdateVfModuleActiveStatus") + .hasPassedInOrder("ActivateVfModuleBB_Start","ExclusiveGateway_1v8bmbu","Setup_AAI_Inventory_Audit", "Audit_AAI_Inventory", "ActivateVfModule", "UpdateVfModuleActiveStatus") .hasNotPassed("ActivateVfModuleBB_End"); } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java index 0e4bb5a194..8c44309cca 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java @@ -40,6 +40,10 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{ "QueryVfModule", "CreateVfModule", "VnfAdapter", + "CreateNetworkPolicies", + "UpdateVnfIpv4OamAddress", + "UpdateVnfManagementV6Address", + "UpdateVfModuleContrailServiceInstanceFqdn", "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); @@ -53,7 +57,9 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{ assertThat(pi).isNotNull(); assertThat(pi).isStarted() .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf") - .hasNotPassed("QueryVfModule", "CreateVfModule", "VnfAdapter", "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); + .hasNotPassed("QueryVfModule", "CreateVfModule", "VnfAdapter", "CreateNetworkPolicies", "UpdateVnfIpv4OamAddress", + "UpdateVnfManagementV6Address","UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId", + "UpdateVfModuleStatus", "CreateVfModuleBB_End"); assertThat(pi).isEnded(); } @@ -64,7 +70,8 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{ assertThat(pi).isNotNull(); assertThat(pi).isStarted() .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule") - .hasNotPassed("CreateVfModule", "VnfAdapter", "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); + .hasNotPassed("CreateVfModule", "VnfAdapter", "CreateNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", + "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); assertThat(pi).isEnded(); } @@ -75,7 +82,8 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{ assertThat(pi).isNotNull(); assertThat(pi).isStarted() .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule") - .hasNotPassed("VnfAdapter", "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); + .hasNotPassed("VnfAdapter", "CreateNetworkPolicies","UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", + "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); assertThat(pi).isEnded(); } @@ -87,7 +95,8 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{ ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted() - .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter", "UpdateVfModuleHeatStackId") + .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter", "CreateNetworkPolicies", + "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId") .hasNotPassed("UpdateVfModuleStatus", "CreateVfModuleBB_End"); assertThat(pi).isEnded(); @@ -100,7 +109,9 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{ ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted() - .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter", "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus") + .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter", "CreateNetworkPolicies", + "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId", + "UpdateVfModuleStatus") .hasNotPassed("CreateVfModuleBB_End"); assertThat(pi).isEnded(); } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java index d9190b5e12..cedffb77d4 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java @@ -38,6 +38,8 @@ public class DeleteVfModuleBBTest extends BaseBPMNTest{ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVfModuleBB", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted().hasPassedInOrder("DeleteVfModuleBB_Start", "DeleteVfModuleVnfAdapter", "VnfAdapter", + "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", + "UpdateVfModuleContrailServiceInstanceFqdn", "UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End"); assertThat(pi).isEnded(); } @@ -49,7 +51,9 @@ public class DeleteVfModuleBBTest extends BaseBPMNTest{ assertThat(pi).isNotNull(); assertThat(pi).isStarted() .hasPassedInOrder("DeleteVfModuleBB_Start", "DeleteVfModuleVnfAdapter") - .hasNotPassed("VnfAdapter", "UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End"); + .hasNotPassed("VnfAdapter", "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", + "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus", + "DeleteVfModuleBB_End"); assertThat(pi).isEnded(); } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java index 1ad2197a51..26e8fcb5b9 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java index 442d7b72c4..b65f30fa9a 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java @@ -21,7 +21,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; diff --git a/bpmn/so-bpmn-building-blocks/src/test/resources/application-test.yaml b/bpmn/so-bpmn-building-blocks/src/test/resources/application-test.yaml index 1090ab7be4..c36172c3bf 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/resources/application-test.yaml +++ b/bpmn/so-bpmn-building-blocks/src/test/resources/application-test.yaml @@ -31,6 +31,10 @@ log: vnfAdapterCreateV1: 'true' vnfAdapterRestV1: 'true' mso: + infra: + auditInventory: true + customer: + id: testCustIdInfra adapters: completemsoprocess: endpoint: http://localhost:28090/CompleteMsoProcess @@ -96,9 +100,6 @@ mso: healthcheck: log: debug: 'false' - infra: - customer: - id: testCustIdInfra logPath: logs msoKey: 07a7159d3bf51a0e53be7a8f89699be7 po: diff --git a/bpmn/so-bpmn-building-blocks/src/test/resources/logback-test.xml b/bpmn/so-bpmn-building-blocks/src/test/resources/logback-test.xml index 64b6bfc81b..d8f6ba3930 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/resources/logback-test.xml +++ b/bpmn/so-bpmn-building-blocks/src/test/resources/logback-test.xml @@ -26,5 +26,5 @@ </root> <logger name="wiremock.org" level="DEBUG" /> -<logger name="org.camunda" level="DEBUG" /> + </configuration>
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy index b912b64145..a8da95aa7c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy @@ -53,7 +53,6 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { MsoUtils msoUtils = new MsoUtils() public void preProcessRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") msoLogger.info(" ***** Started preProcessRequest *****") try { @@ -64,7 +63,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { String resourceInput = execution.getVariable("resourceInput") //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) - execution.setVariable(Prefix + "resourceInput", resourceInputObj) + execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString()) //Deal with recipeParams String recipeParamsFromWf = execution.getVariable("recipeParamXsd") @@ -125,8 +124,8 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug( msg) + String msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -398,7 +397,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in CreateSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() - msoLogger.debug( exceptionMessage) + msoLogger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -415,21 +414,21 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { } public void sendSyncResponse(DelegateExecution execution) { - msoLogger.dubug(" *** sendSyncResponse *** ") + msoLogger.info("started sendsyncResp") try { String operationStatus = "finished" // RESTResponse for main flow String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - msoLogger.dubug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) + msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) sendWorkflowResponse(execution, 202, resourceOperationResp) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { String msg = "Exception in sendSyncResponse:" + ex.getMessage() - msoLogger.debug( msg) + msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.dubug(" ***** Exit sendSyncResponse *****") + msoLogger.info("exited send sync Resp") } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy index 6ef446b490..02ae6a6f48 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy @@ -302,7 +302,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor xmlns:ns="http://org.onap.so/requestsdb"> <soapenv:Header/> <soapenv:Body> - <ns:updateServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb"> + <ns:initServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb"> <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId> <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> <operationType>${MsoUtils.xmlEscape(operationType)}</operationType> @@ -311,7 +311,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent> <progress>${MsoUtils.xmlEscape(progress)}</progress> <reason>${MsoUtils.xmlEscape(reason)}</reason> - </ns:updateServiceOperationStatus> + </ns:initServiceOperationStatus> </soapenv:Body> </soapenv:Envelope>""" diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy index 9763960bfd..848785e5f3 100755 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy @@ -165,6 +165,10 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro msoLogger.debug("User Input Parameter " + userParam.name + ": " + userParam.value.toString()) inputMap.put(userParam.name, userParam.value) } + if ("Orchestrator".equalsIgnoreCase(userParam?.name)) { + execution.setVariable("orchestrator", userParam.value) + inputMap.put("orchestrator", userParam.value) + } } } @@ -344,6 +348,10 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro msoLogger.debug("User Input Parameter " + userParam.name + ": " + userParam.value.toString()) inputMap.put(userParam.name, userParam.value) } + if ("Orchestrator".equalsIgnoreCase(userParam?.name)) { + execution.setVariable("orchestrator", userParam.value) + inputMap.put("orchestrator", userParam.value) + } } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index b2c278b64c..9301f3d508 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 @@ -203,7 +203,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.access-ltp-id", inputParameters.get("local-access-ltp-id")) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.access-node-id", inputParameters.get("local-access-node-id")) resourceInputObj.setResourceParameters(uResourceInput) - execution.setVariable(Prefix + "resourceInput", resourceInputObj) + execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString()) } break @@ -539,10 +539,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { private def getInstnaceId(DelegateExecution execution) { def response = new XmlSlurper().parseText(execution.getVariable("CRENWKI_createSDNCResponse")) - def data = response.toString() - data = data.substring(data.indexOf("<")) - def resp = new XmlSlurper().parseText(data) ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(execution.getVariable(Prefix + "resourceInput"), ResourceInput.class) String modelName = resourceInputObj.getResourceModelInfo().getModelName() def val = "" @@ -551,17 +548,17 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : case ~/[\w\s\W]*Site[\w\s\W]*/: - val = resp."vnf-response-information"."instance-id" + val = response."response-data"."RequestData"."output"."vnf-response-information"."instance-id" break case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/: - val = resp."connection-attachment-response-information"."instance-id" + val = response."response-data"."RequestData"."output"."connection-attachment-response-information"."instance-id" break // for SDWANConnectivity and SOTNConnectivity and default: default: - val = resp."network-response-information"."instance-id" + val = response."response-data"."RequestData"."output"."network-response-information"."instance-id" break } 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 aa1eed95bb..6096f16b18 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 @@ -104,7 +104,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ // get Sequence from csar(model) if(resourceSequence == null) { - resourceSequence = ResourceRequestBuilder.getResourceSequence(execution, serviceModelUuid) + resourceSequence = ResourceRequestBuilder.getResourceSequence(serviceModelUuid) msoLogger.info("Get Sequence from csar : " + resourceSequence) } 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 1d3d3331ef..53e3525036 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 @@ -41,10 +41,12 @@ 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.VfModuleBase +import org.onap.so.bpmn.common.util.OofInfraUtils 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.HttpClient import org.onap.so.client.aai.AAIObjectPlurals @@ -56,6 +58,7 @@ import org.onap.so.client.aai.entities.uri.AAIUri import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.constants.Defaults +import org.onap.so.db.catalog.beans.HomingInstance import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger @@ -78,7 +81,9 @@ public class DoCreateVfModule extends VfModuleBase { ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + OofInfraUtils oofInfraUtils = new OofInfraUtils() CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create() + DecomposeJsonUtil decomposeJsonUtils = new DecomposeJsonUtil() private final HttpClientFactory httpClientFactory = new HttpClientFactory() /** @@ -235,12 +240,37 @@ public class DoCreateVfModule extends VfModuleBase { String globalSubscriberId = execution.getVariable("globalSubscriberId") execution.setVariable("DCVFM_globalSubscriberId", globalSubscriberId) msoLogger.debug("globalSubsrciberId: " + globalSubscriberId) - //OofDirectives - String oofDirectives = execution.getVariable("oofDirectives") + + // Set Homing Info + String oofDirectives = null + try { + HomingInstance homingInstance = oofInfraUtils.getHomingInstance(serviceInstanceId, execution) + if (homingInstance != null) { + execution.setVariable("DCVFM_cloudSiteId", homingInstance.getCloudRegionId()) + rollbackData.put("VFMODULE", "aiccloudregion", homingInstance.getCloudRegionId()) + msoLogger.debug("Overwriting cloudSiteId with homing cloudSiteId: " + + homingInstance.getCloudRegionId()) + execution.setVariable("DCVFM_cloudOwner", homingInstance.getCloudOwner()) + rollbackData.put("VFMODULE", "cloudOwner", homingInstance.getCloudOwner()) + msoLogger.debug("Overwriting cloudOwner with homing cloudOwner: " + + homingInstance.getCloudOwner()) + oofDirectives = homingInstance.getOofDirectives() + execution.setVariable("DCVFM_oofDirectives", oofDirectives) + } + } catch (Exception exception) { + msoLogger.debug("Could not find homing information for service instance: " + serviceInstanceId + + "... continuing") + msoLogger.debug("Could not find homing information for service instance error: " + exception) + } + //OofDirectives to Input Params Map<String,String> vfModuleInputParams = execution.getVariable("vfModuleInputParams") - if (oofDirectives != null) { - vfModuleInputParams.put("oofDirectives", oofDirectives) - logDebug("OofDirectives are: " + oofDirectives, isDebugLogEnabled) + if (oofDirectives != null && vfModuleInputParams != null) { + vfModuleInputParams.put("oof_directives", oofDirectives) + vfModuleInputParams.put("sdnc_directives", "{}") + msoLogger.debug("OofDirectives are: " + oofDirectives) + } else if (vfModuleInputParams != null) { + vfModuleInputParams.put("oof_directives", "{}") + vfModuleInputParams.put("sdnc_directives", "{}") } if (vfModuleInputParams != null) { execution.setVariable("DCVFM_vnfParamsMap", vfModuleInputParams) @@ -467,11 +497,30 @@ public class DoCreateVfModule extends VfModuleBase { } //OofDirectives - String oofDirectives = execution.getVariable("oofDirectives") + String oofDirectives = null + try { + HomingInstance homingInstance = oofInfraUtils.getHomingInstance(serviceInstanceId, execution) + if (homingInstance != null) { + execution.setVariable("DCVFM_cloudSiteId", homingInstance.getCloudRegionId()) + rollbackData.put("VFMODULE", "aiccloudregion", homingInstance.getCloudRegionId()) + msoLogger.debug("Overwriting cloudSiteId with homing cloudSiteId: " + + homingInstance.getCloudRegionId()) + execution.setVariable("DCVFM_cloudOwner", homingInstance.getCloudOwner()) + rollbackData.put("VFMODULE", "cloudOwner", homingInstance.getCloudOwner()) + msoLogger.debug("Overwriting cloudOwner with homing cloudOwner: " + + homingInstance.getCloudOwner()) + oofDirectives = homingInstance.getOofDirectives() + execution.setVariable("DCVFM_oofDirectives", oofDirectives) + } + } catch (Exception exception) { + msoLogger.debug("Could not find homing information for service instance: " + serviceInstanceId + + "... continuing") + msoLogger.debug("Could not find homing information for service instance error: " + exception) + } if (oofDirectives != null) { Map<String, String> paramsMap = execution.getVariable("DCVFM_vnfParamsMap") paramsMap.put("oofDirectives", oofDirectives) - logDebug("OofDirectives are: " + oofDirectives, isDebugLogEnabled) + msoLogger.debug("OofDirectives are: " + oofDirectives) execution.setVariable("DCVFM_vnfParamsMap", paramsMap) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy index b35aab1176..deb0bffaf9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy @@ -20,6 +20,8 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.so.db.catalog.beans.HomingInstance + import static org.apache.commons.lang3.StringUtils.* import org.camunda.bpm.engine.delegate.BpmnError @@ -31,6 +33,7 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.common.scripts.VidUtils +import org.onap.so.bpmn.common.util.OofInfraUtils import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException @@ -61,6 +64,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { JsonUtils jsonUtil = new JsonUtils() VidUtils vidUtils = new VidUtils(this) SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + OofInfraUtils oofInfraUtils = new OofInfraUtils() /** * This method gets and validates the incoming @@ -238,6 +242,21 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { execution.setVariable("DoCVNF_nfFunction", nfFunction) msoLogger.debug("NF Function is: " + nfFunction) + // Set Homing Info + try { + HomingInstance homingInstance = oofInfraUtils.getHomingInstance(serviceInstanceId, execution) + if (homingInstance != null) { + execution.setVariable("DoCVNF_cloudSiteId", homingInstance.getCloudRegionId()) + rollbackData.put("VNF", "cloudSiteId", homingInstance.getCloudRegionId()) + msoLogger.debug("Overwriting cloudSiteId with homing cloudSiteId: " + + homingInstance.getCloudRegionId()) + } + } catch (Exception exception) { + msoLogger.debug("Could not find homing information for service instance: " + serviceInstanceId + + "... continuing") + msoLogger.debug("Could not find homing information for service instance error: " + exception) + } + rollbackData.put("VNF", "rollbackSDNCAssign", "false") rollbackData.put("VNF", "rollbackSDNCActivate", "false") rollbackData.put("VNF", "rollbackVnfCreate", "false") 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 232336b0ee..88e7b34dcd 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 @@ -118,7 +118,10 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { } } execution.setVariable("vnfId", vnfId) - + + Map<String,String> vfModuleNames = execution.getVariable("vfModuleNames") + msoLogger.debug("Incoming vfModuleNames: " + vfModuleNames) + // Set aLaCarte to false execution.setVariable("aLaCarte", false) @@ -137,9 +140,17 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "0") execution.setVariable("rollbackData", rollbackData) - sleep (20000) + String delayMS = execution.getVariable("delayMS") + long longDelayMS = 20000; + if (delayMS != null && !delayMS.isEmpty()) { + longDelayMS = Long.parseLong(delayMS); + } + if (longDelayMS > 0) { + msoLogger.debug("Delaying workflow " + longDelayMS + "ms"); + sleep(longDelayMS) + } }catch(BpmnError b){ msoLogger.debug("Rethrowing MSOWorkflowException") throw b @@ -151,7 +162,6 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { msoLogger.trace("COMPLETED DoCreateVnfAndModules PreProcessRequest Process") } - public void queryCatalogDB (DelegateExecution execution) { execution.setVariable("prefix",Prefix) @@ -159,8 +169,8 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { msoLogger.trace("STARTED DoCreateVnfAndModules QueryCatalogDB Process") try { VnfResource vnf = null - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") // if serviceDecomposition is specified, get info from serviceDecomposition + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") if (serviceDecomposition != null) { msoLogger.debug("Getting Catalog DB data from ServiceDecomposition object: " + serviceDecomposition.toJsonString()) List<VnfResource> vnfs = serviceDecomposition.getVnfResources() @@ -208,6 +218,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { } ModuleResource baseVfModule = null + Map<String,String> vfModuleNames = execution.getVariable("vfModuleNames") for (int i = 0; i < vfModules.size; i++) { msoLogger.debug("handling VF Module ") @@ -222,6 +233,8 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { execution.setVariable("baseVfModuleLabel", baseVfModuleLabel) String basePersonaModelId = baseVfModuleModelInfoObject.getModelInvariantUuid() execution.setVariable("basePersonaModelId", basePersonaModelId) + String baseVfModuleName = getPredefinedVfModuleName(execution, basePersonaModelId) + execution.setVariable("baseVfModuleName", baseVfModuleName) baseVfModule = vfModule break } @@ -284,6 +297,8 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { execution.setVariable("addOnVfModuleLabel", addOnVfModuleLabel) String addOnPersonaModelId = addOnVfModuleModelInfoObject.getModelInvariantUuid() execution.setVariable("addOnPersonaModelId", addOnPersonaModelId) + String addOnVfModuleName = getPredefinedVfModuleName(execution, addOnPersonaModelId) + execution.setVariable("addOnVfModuleName", addOnVfModuleName) int addOnInitialCount = addOnModule.getInitialCount() execution.setVariable("initialCount", addOnInitialCount) @@ -460,5 +475,19 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { msoLogger.trace("Exit createLineOfBusiness") } + public String getPredefinedVfModuleName(DelegateExecution execution, String vfModuleModelInvariantUuid) { + Map<String,String> vfModuleNames = execution.getVariable("vfModuleNames") + + if (vfModuleNames == null) { + return null + } + + String vfModuleName = vfModuleNames.get(vfModuleModelInvariantUuid) -}
\ No newline at end of file + if (vfModuleName != null) { + msoLogger.debug("Using vfModuleName='" + vfModuleName + "' for vfModuleModelInvariantUuid=" + vfModuleModelInvariantUuid) + } + + return vfModuleName + } +} 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 6109d8631f..7c8a1d70e1 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 @@ -149,7 +149,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces } /** - * instantiate NS task + * terminate NS task */ public void terminateNetworkService(DelegateExecution execution) { @@ -247,19 +247,19 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces msoLogger.trace("Started Execute VFC adapter Delete Process ") msoLogger.info("url:"+url +"\nrequestBody:"+ requestBody) - Response r + Response r try{ - URL Url = new URL(url) + URL Url = new URL(url) // 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) - + httpClient.addAdditionalHeader("Content-Type", "application/json") + r = httpClient.delete(requestBody) + msoLogger.trace("Completed Execute VF-C adapter Delete Process ") }catch(Exception e){ msoLogger.error("Exception occured while executing VF-C Post Call. Exception is: \n" + e.getMessage()); 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 a8e3b2040b..13d5aad2b0 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 @@ -97,7 +97,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { InitializeProcessVariables(execution) //Config Inputs - String aaiDistDelay = UrnPropertiesReader.getVariable("aai.workflowAaiDistributionDelay") + String aaiDistDelay = UrnPropertiesReader.getVariable("aai.workflowAaiDistributionDelay", execution) if (isBlank(aaiDistDelay)) { String msg = "workflowAaiDistributionDelay is null" msoLogger.debug(msg) @@ -209,14 +209,13 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { def userParams = reqMap.requestDetails?.requestParameters?.userParams Map<String, String> inputMap = [:] - if (userParams) { + if (userParams) { userParams.each { - userParam -> + userParam -> if ("Customer_Location".equals(userParam?.name)) { Map<String, String> customerMap = [:] userParam.value.each { param -> - inputMap.put(param.key, param.value) customerMap.put(param.key, param.value) } @@ -238,7 +237,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { param.getClass() , isDebugEnabled) } execution.setVariable("homingModelIds", modelIdLst) - } + } if ("BRG_WAN_MAC_Address".equals(userParam?.name)) { execution.setVariable("brgWanMacAddress", userParam.value) inputMap.put("BRG_WAN_MAC_Address", userParam.value) @@ -247,7 +246,34 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable("homingService", userParam.value) execution.setVariable("callHoming", true) inputMap.put("Homing_Solution", userParam.value) - } + } + if ("Orchestrator".equalsIgnoreCase(userParam?.name)) { + execution.setVariable("orchestrator", userParam.value) + inputMap.put("orchestrator", userParam.value) + } + if ("VfModuleNames".equals(userParam?.name)) { + utils.log("DEBUG", "VfModuleNames: " + userParam.value.toString(), isDebugEnabled) + def vfModuleNames = [:] + userParam.value.each { + entry -> + String vfModuleModelInvariantUuid = null; + String vfModuleName = null; + entry.each { + param -> + if ("VfModuleModelInvariantUuid".equals(param.key)) { + vfModuleModelInvariantUuid = param.value; + } else if ("VfModuleName".equals(param.key)) { + vfModuleName = param.value; + } + } + + if (vfModuleModelInvariantUuid != null && !vfModuleModelInvariantUuid.isEmpty() && vfModuleName != null && !vfModuleName.isEmpty()) { + vfModuleNames.put(vfModuleModelInvariantUuid, vfModuleName) + utils.log("DEBUG", "VfModuleModelInvariantUuid: " + vfModuleModelInvariantUuid + " VfModuleName: " + vfModuleName, isDebugEnabled) + } + } + execution.setVariable("vfModuleNames", vfModuleNames) + } } } @@ -257,7 +283,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { } msoLogger.debug("User Input Parameters map: " + userParams.toString()) - execution.setVariable("serviceInputParams", inputMap) + execution.setVariable("serviceInputParams", inputMap) // DOES NOT SEEM TO BE USED msoLogger.debug("Incoming brgWanMacAddress is: " + execution.getVariable('brgWanMacAddress')) 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 e9b0bc77b2..c1ddf2e04e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java @@ -27,7 +27,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName 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; @@ -39,8 +38,7 @@ 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}$"); + public static final String UUID_REGEX = "(?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; @@ -69,7 +67,7 @@ public class PnfCheckInputs implements JavaDelegate { if (Strings.isNullOrEmpty(pnfUuid)) { new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "pnfUuid variable not defined"); } - if (!UUID_PATTERN.matcher(pnfUuid).matches()) { + if (!pnfUuid.matches(UUID_REGEX)) { new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "pnfUuid is not a valid UUID"); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java index 60f109a81f..0d7c4abeee 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.properties; import java.util.Arrays; import java.util.List; +import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.logger.MsoLogger; @@ -37,7 +38,7 @@ public class BPMNProperties { } public static List<String> getResourceSequenceProp(String input) { - String resourceSequence = getProperty("mso.workflow.custom." + input + ".resource.sequence", null); + String resourceSequence = UrnPropertiesReader.getVariable("mso.workflow.custom."+ input + ".resource.sequence"); if (resourceSequence != null) { return Arrays.asList(resourceSequence.split(",")); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/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 ac341886ba..48c78632dd 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 @@ -430,14 +430,19 @@ public class ServicePluginFactory { Map<String, String> keys = uri.getURIKeys(); String uriString = uri.build().toString(); - AAIResourceUri parent = AAIUriFactory.createResourceUri(AAIObjectType.PNF, keys.get("pnf-name")); - - AAIResultWrapper wrapper = client.get(parent); - Optional<Relationships> optRelationships = wrapper.getRelationships(); - if (optRelationships.isPresent()) { - Relationships relationships = optRelationships.get(); - - return !relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty(); + + if (uriString != null) { + // get the pnfname + String[] token = uriString.split("/"); + AAIResourceUri parent = AAIUriFactory.createResourceUri(AAIObjectType.PNF, token[4]); + + AAIResultWrapper wrapper = client.get(parent); + Optional<Relationships> optRelationships = wrapper.getRelationships(); + if (optRelationships.isPresent()) { + Relationships relationships = optRelationships.get(); + + return !relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty(); + } } return false; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java index 3c4a35737b..3108adaa53 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java @@ -93,7 +93,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask { logger.info("AbstractSdncOperationTask.updateResOperStatus begin!"); String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint"); HttpPost httpPost = new HttpPost(requestsdbEndPoint); - httpPost.addHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); + httpPost.addHeader("Authorization", "Basic YnBlbDpwYXNzd29yZDEk"); httpPost.addHeader("Content-type", "application/soap+xml"); String postBody = getPostStringBody(resourceOperationStatus); httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); @@ -174,7 +174,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask { logger.info("AbstractSdncOperationTask.getResourceOperationStatus begin!"); String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint"); HttpPost httpPost = new HttpPost(requestsdbEndPoint); - httpPost.addHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); + httpPost.addHeader("Authorization", "Basic YnBlbDpwYXNzd29yZDEk"); httpPost.addHeader("Content-type", "application/soap+xml"); String getBody = getGetStringBody(serviceId, operationId, resourceTemplateUUID); httpPost.setEntity(new StringEntity(getBody, ContentType.APPLICATION_XML)); @@ -289,9 +289,8 @@ public abstract class AbstractSdncOperationTask extends BaseTask { protected boolean isSend2SdncDirectly() { logger.info("AbstractSdncOperationTask.isSend2SdncDirectly begin!"); - String sdncIp = UrnPropertiesReader.getVariable("sdnc-ip"); - String sdncPort = UrnPropertiesReader.getVariable("sdnc-port"); - if (!StringUtils.isBlank(sdncIp) && isIp(sdncIp) && !StringUtils.isBlank(sdncPort)) { + String sdncHost = UrnPropertiesReader.getVariable("sdnc.host"); + if (!StringUtils.isBlank(sdncHost)) { logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = true."); return true; } @@ -317,6 +316,12 @@ public abstract class AbstractSdncOperationTask extends BaseTask { return returnPort; } + protected String getSdncHost() { + String sdncHost = UrnPropertiesReader.getVariable("sdnc.host"); + logger.info("AbstractSdncOperationTask.getSdncPort: returnPort = {}", sdncHost); + return sdncHost; + } + private GenericResourceApi getGenericResourceApiClient() { logger.info("AbstractSdncOperationTask.getGenericResourceApiClient begin!"); String msbIp = System.getenv().get(ONAP_IP); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java index 8e41d0d88e..dc625d35c3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java @@ -72,7 +72,7 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask private void send2SdncDirectly(String defaulAuth, RpcServiceTopologyOperationInputEntity inputEntity) throws RouteException { sdncLogger.info("SdncServiceTopologyOperationTask.send2SdncDirectly begin!"); - String url = "http://" + getSdncIp() + ":" + getSdncPort() + URL; + String url = getSdncHost() + URL; HttpPost httpPost = new HttpPost(url); httpPost.addHeader("Authorization", defaulAuth); httpPost.addHeader("Content-type", "application/json"); diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy index 820c14eb94..8dde45be81 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy @@ -129,10 +129,7 @@ class CreateSDNCNetworkResourceTest extends GroovyTestCase { private getInstanceId() { def response = new XmlSlurper().parseText(sdncAdapterWorkflowResponse) - def data = response.toString() - data = data.substring(data.indexOf("<")) - def resp = new XmlSlurper().parseText(data) - def instanceId = resp."network-response-information"."instance-id" + def instanceId = response."response-data"."RequestData"."output"."network-response-information"."instance-id" return instanceId } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResourceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResourceTest.groovy index 2eb4c9c408..d4857503b5 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResourceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResourceTest.groovy @@ -34,7 +34,7 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory import javax.ws.rs.NotFoundException import static org.junit.Assert.assertEquals -import static org.mockito.Matchers.isA +import static org.mockito.ArgumentMatchers.isA import static org.mockito.Mockito.doNothing import static org.mockito.Mockito.doThrow import static org.mockito.Mockito.when diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy index 0e7114dd03..50d5506c23 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy @@ -43,7 +43,7 @@ import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputation import javax.ws.rs.NotFoundException -import static org.mockito.Matchers.eq +import static org.mockito.ArgumentMatchers.eq import static org.mockito.Mockito.doNothing import static org.mockito.Mockito.doThrow import static org.mockito.Mockito.times diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy index 52b54a48e8..c359f74d7f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy @@ -37,7 +37,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import javax.ws.rs.NotFoundException import static org.junit.Assert.assertEquals -import static org.mockito.Matchers.isA +import static org.mockito.ArgumentMatchers.isA import static org.mockito.Mockito.doNothing import static org.mockito.Mockito.doThrow import static org.mockito.Mockito.when diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy index 606efa8b73..ddb1fbade4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy @@ -46,7 +46,7 @@ import org.onap.so.constants.Defaults import static org.junit.Assert.assertEquals import static org.junit.Assert.assertNotNull -import static org.mockito.Matchers.anyObject +import static org.mockito.ArgumentMatchers.anyObject import static org.mockito.Mockito.spy import static org.mockito.Mockito.times import static org.mockito.Mockito.verify diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesTest.groovy new file mode 100644 index 0000000000..47db6b3b7b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesTest.groovy @@ -0,0 +1,452 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.AllottedResource +import org.onap.so.bpmn.core.domain.HomingSolution +import org.onap.so.bpmn.core.domain.InventoryType +import org.onap.so.bpmn.core.domain.License +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ModuleResource +import org.onap.so.bpmn.core.domain.NetworkResource +import org.onap.so.bpmn.core.domain.ResourceInstance +import org.onap.so.bpmn.core.domain.ResourceType +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceInstance +import org.onap.so.bpmn.core.domain.VnfResource + +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +class DoCreateVnfAndModulesTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Before + void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Test + void testPreProcessRequest() { + ExecutionEntity mockExecution = setupMock() + setupBasicProcessInputs(mockExecution) + + ServiceDecomposition serviceDecomposition = createServiceDecomposition() + when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomposition) + + Map<String,String> vfModuleNames = new HashMap<String,String>() + vfModuleNames.put("3ec98c7a-ac20-49a1-9e0d-09fea7e8db45", "VGWA:e2:25:25:25:%") + vfModuleNames.put("cc250e7e-746b-4d84-8064-df20c74213a6", "VGWB:f9:32:32:32:%") + when(mockExecution.getVariable("vfModuleNames")).thenReturn(vfModuleNames) + + DoCreateVnfAndModules obj = new DoCreateVnfAndModules() + obj.preProcessRequest(mockExecution) + + Mockito.verify(mockExecution, times(11)).setVariable(captor.capture(), captor.capture()) + + List list = captor.getAllValues() + for (int i = 0; i < list.size(); i+=2) { + System.out.println("captor[" + i/2 + "]: " + list.get(i) + + (i+1 < list.size() ? ("=" + list.get(i+1)) : "")) + } + + String someKey = list.get(18) + Assert.assertEquals("numOfCreatedAddOnModules", someKey) + Integer someValue = list.get(19) + Assert.assertEquals(0, someValue) + + String lastKey = list.get(20) + Assert.assertEquals("rollbackData", lastKey) + } + + @Test + void testQueryCatalogDB() { + ExecutionEntity mockExecution = setupMock() + setupBasicProcessInputs(mockExecution) + + ServiceDecomposition serviceDecomposition = createServiceDecomposition() + when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomposition) + + DoCreateVnfAndModules obj = new DoCreateVnfAndModules() + obj.queryCatalogDB(mockExecution) + + Mockito.verify(mockExecution, times(11)).setVariable(captor.capture(), captor.capture()) + + List list = captor.getAllValues() + for (int i = 0; i < list.size(); i+=2) { + System.out.println("captor[" + i/2 + "]: " + list.get(i) + + (i+1 < list.size() ? ("=" + list.get(i+1)) : "")) + } + + String vfModuleNameKey = list.get(12) + Assert.assertEquals("baseVfModuleName", vfModuleNameKey) + String vfModuleNameValue = list.get(13) + Assert.assertEquals(null, vfModuleNameValue) + + String lastKey = list.get(20) + Assert.assertEquals("baseVfModuleId", lastKey) + } + + @Test + void testQueryCatalogDBWithVfModuleNames() { + ExecutionEntity mockExecution = setupMock() + setupBasicProcessInputs(mockExecution) + + ServiceDecomposition serviceDecomposition = createServiceDecomposition() + when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomposition) + + Map<String,String> vfModuleNames = new HashMap<String,String>() + vfModuleNames.put("3ec98c7a-ac20-49a1-9e0d-09fea7e8db45", "VGWA:e2:25:25:25:%") + vfModuleNames.put("cc250e7e-746b-4d84-8064-df20c74213a6", "VGWB:f9:32:32:32:%") + when(mockExecution.getVariable("vfModuleNames")).thenReturn(vfModuleNames) + + DoCreateVnfAndModules obj = new DoCreateVnfAndModules() + obj.queryCatalogDB(mockExecution) + + Mockito.verify(mockExecution, times(11)).setVariable(captor.capture(), captor.capture()) + + List list = captor.getAllValues() + for (int i = 0; i < list.size(); i+=2) { + System.out.println("captor[" + i/2 + "]: " + list.get(i) + + (i+1 < list.size() ? ("=" + list.get(i+1)) : "")) + } + + String vfModuleNameKey = list.get(12) + Assert.assertEquals("baseVfModuleName", vfModuleNameKey) + String vfModuleNameValue = list.get(13) + Assert.assertEquals("VGWA:e2:25:25:25:%", vfModuleNameValue) + + String lastKey = list.get(20) + Assert.assertEquals("baseVfModuleId", lastKey) + } + + @Test + void testPreProcessAddonModule() { + ExecutionEntity mockExecution = setupMock() + setupBasicProcessInputs(mockExecution) + + ServiceDecomposition serviceDecomposition = createServiceDecomposition() + when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomposition) + + VnfResource vnf = serviceDecomposition.getVnfResources().get(0); + List<ModuleResource> vfModules = vnf.getAllVfModuleObjects() + + for (int i = vfModules.size()-1; i >= 0; i--) { + if (vfModules.get(i).getIsBase()) { + vfModules.remove(i); + } + } + + when(mockExecution.getVariable("addOnModules")).thenReturn(vfModules) + when(mockExecution.getVariable("addOnModulesDeployed")).thenReturn(0) + + DoCreateVnfAndModules obj = new DoCreateVnfAndModules() + obj.preProcessAddOnModule(mockExecution) + + Mockito.verify(mockExecution, times(9)).setVariable(captor.capture(), captor.capture()) + + List list = captor.getAllValues() + for (int i = 0; i < list.size(); i+=2) { + System.out.println("captor[" + i/2 + "]: " + list.get(i) + + (i+1 < list.size() ? ("=" + list.get(i+1)) : "")) + } + + String vfModuleNameKey = list.get(14) + Assert.assertEquals("addOnVfModuleName", vfModuleNameKey) + String vfModuleNameValue = list.get(15) + Assert.assertEquals(null, vfModuleNameValue) + + String lastKey = list.get(16) + Assert.assertEquals("initialCount", lastKey) + } + + @Test + void testPreProcessAddonModuleWithVfModuleNames() { + ExecutionEntity mockExecution = setupMock() + setupBasicProcessInputs(mockExecution) + + ServiceDecomposition serviceDecomposition = createServiceDecomposition() + when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomposition) + + Map<String,String> vfModuleNames = new HashMap<String,String>() + vfModuleNames.put("3ec98c7a-ac20-49a1-9e0d-09fea7e8db45", "VGWA:e2:25:25:25:%") + vfModuleNames.put("cc250e7e-746b-4d84-8064-df20c74213a6", "VGWB:f9:32:32:32:%") + when(mockExecution.getVariable("vfModuleNames")).thenReturn(vfModuleNames) + + VnfResource vnf = serviceDecomposition.getVnfResources().get(0); + List<ModuleResource> vfModules = vnf.getAllVfModuleObjects() + + for (int i = vfModules.size()-1; i >= 0; i--) { + if (vfModules.get(i).getIsBase()) { + vfModules.remove(i); + } + } + + when(mockExecution.getVariable("addOnModules")).thenReturn(vfModules) + when(mockExecution.getVariable("addOnModulesDeployed")).thenReturn(0) + + DoCreateVnfAndModules obj = new DoCreateVnfAndModules() + obj.preProcessAddOnModule(mockExecution) + + Mockito.verify(mockExecution, times(9)).setVariable(captor.capture(), captor.capture()) + + List list = captor.getAllValues() + for (int i = 0; i < list.size(); i+=2) { + System.out.println("captor[" + i/2 + "]: " + list.get(i) + + (i+1 < list.size() ? ("=" + list.get(i+1)) : "")) + } + + String vfModuleNameKey = list.get(14) + Assert.assertEquals("addOnVfModuleName", vfModuleNameKey) + String vfModuleNameValue = list.get(15) + Assert.assertEquals("VGWB:f9:32:32:32:%", vfModuleNameValue) + + String lastKey = list.get(16) + Assert.assertEquals("initialCount", lastKey) + } + + private static setupBasicProcessInputs(ExecutionEntity mockExecution) { + when(mockExecution.getVariable("prefix")).thenReturn("DCVAM_") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("msoRequestId")).thenReturn("28a7f01e-a6aa-44fd-b25e-e06e14873cd7") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("7d34a7df-d6c3-4f1c-8710-576412134a5a") + when(mockExecution.getVariable("productFamilyId")).thenReturn("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") + when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("RegionOne") + when(mockExecution.getVariable("tenantId")).thenReturn("b8ad3842ab3642f7bf3fbe4e4d3b9f86") + when(mockExecution.getVariable("disableRollback")).thenReturn("true") + when(mockExecution.getVariable("delayMS")).thenReturn("0") + + } + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoCreateVnfAndModules") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoCreateVnfAndModules") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoCreateVnfAndModules") + when(mockExecution.getProcessInstanceId()).thenReturn("DoCreateVnfAndModules") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + + public static ServiceDecomposition createServiceDecomposition() { + ServiceDecomposition serviceDecomposition = new ServiceDecomposition() + + ServiceInstance serviceInstance = new ServiceInstance() + serviceInstance.setInstanceId("7d34a7df-d6c3-4f1c-8710-576412134a5a") + serviceDecomposition.setServiceInstance(serviceInstance) + serviceDecomposition.setServiceType("") + serviceDecomposition.setServiceRole("") + + ModelInfo serviceModelInfo = new ModelInfo() + serviceDecomposition.setModelInfo(serviceModelInfo) + serviceModelInfo.setModelName("vcpesvc_rescust_1111") + serviceModelInfo.setModelUuid("1dffd5f9-bb29-4a47-8073-9b9b07f4943a") + serviceModelInfo.setModelVersion("1.0") + serviceModelInfo.setModelCustomizationUuid("") + serviceModelInfo.setModelCustomizationName("") + serviceModelInfo.setModelInstanceName("") + serviceModelInfo.setModelType("") + + List<VnfResource> vnfResources = new ArrayList<VnfResource>() + serviceDecomposition.setVnfResources(vnfResources) + + VnfResource vnfResource = new VnfResource() + vnfResources.add(vnfResource) + vnfResource.setResourceId("9504b6b3-d346-4387-952c-8f9b7570b055") + vnfResource.setResourceType(ResourceType.VNF) + ModelInfo vnfModelInfo = new ModelInfo() + vnfResource.setModelInfo(vnfModelInfo) + vnfModelInfo.setModelName("vcpevsp_vgw_1111") + vnfModelInfo.setModelUuid("289e96fd-a679-4286-a8a2-d76f930d650b") + vnfModelInfo.setModelInvariantUuid("0327af89-f836-4086-aadb-17d5c9bd8a83"); + vnfModelInfo.setModelVersion("1.0"); + vnfModelInfo.setModelCustomizationUuid("cf151beb-9510-44a1-a165-c783e673baa1"); + vnfModelInfo.setModelCustomizationName(""); + vnfModelInfo.setModelInstanceName("vcpevsp_vgw_1111 0") + vnfModelInfo.setModelType("") + vnfResource.setResourceInstance(new ResourceInstance()) + vnfResource.setHomingSolution(new HomingSolution()) + vnfResource.setToscaNodeType("org.openecomp.resource.vf.VcpevspVgw1111") + vnfResource.setMultiStageDesign("false") + vnfResource.setMultiStageDesign("false") + + List<ModuleResource> moduleResources = new ArrayList<ModuleResource>() + vnfResource.setModules(moduleResources) + + ModuleResource moduleResource = new ModuleResource() + moduleResources.add(moduleResource) + moduleResource.setResourceType(ResourceType.MODULE) + ModelInfo moduleModelInfo = new ModelInfo() + moduleResource.setModelInfo(moduleModelInfo); + moduleModelInfo.setModelName("VcpevspVgw1111..base_vcpe_vgw..module-0") + moduleModelInfo.setModelUuid("cf35b6b8-1f31-4efc-87a7-d53f840b8fdf") + moduleModelInfo.setModelInvariantUuid("3ec98c7a-ac20-49a1-9e0d-09fea7e8db45") + moduleModelInfo.setModelVersion("1") + moduleModelInfo.setModelCustomizationUuid("281085b3-4598-4c94-811d-58cc685763e7") + moduleModelInfo.setModelCustomizationName("") + moduleModelInfo.setModelInstanceName("") + moduleModelInfo.setModelType("") + moduleResource.setResourceInstance(new ResourceInstance()) + moduleResource.setHomingSolution(new HomingSolution()) + moduleResource.setHasVolumeGroup(false) + moduleResource.setIsBase(true) + moduleResource.setVfModuleLabel("base_vcpe_vgw") + moduleResource.setInitialCount(1) + + // For testing an add-on module; not in the actual vCPE model + moduleResource = new ModuleResource() + moduleResources.add(moduleResource) + moduleResource.setResourceType(ResourceType.MODULE) + moduleModelInfo = new ModelInfo() + moduleResource.setModelInfo(moduleModelInfo); + moduleModelInfo.setModelName("VcpevspVgw1111..addon_vcpe_vgw..module-1") + moduleModelInfo.setModelUuid("8c8b41b2-8466-41b4-ae8d-5924830c40e8") + moduleModelInfo.setModelInvariantUuid("cc250e7e-746b-4d84-8064-df20c74213a6") + moduleModelInfo.setModelVersion("1") + moduleModelInfo.setModelCustomizationUuid("99424afc-1fb4-4598-a99b-3e0690b4cb03") + moduleModelInfo.setModelCustomizationName("") + moduleModelInfo.setModelInstanceName("") + moduleModelInfo.setModelType("") + moduleResource.setResourceInstance(new ResourceInstance()) + moduleResource.setHomingSolution(new HomingSolution()) + moduleResource.setHasVolumeGroup(false) + moduleResource.setIsBase(false) + moduleResource.setVfModuleLabel("addon_vcpe_vgw") + moduleResource.setInitialCount(1) + + serviceDecomposition.setNetworkResources(new ArrayList<NetworkResource>()) + + List<AllottedResource> allottedResources = new ArrayList<AllottedResource>() + serviceDecomposition.setAllottedResources(allottedResources) + + AllottedResource ar = new AllottedResource() + allottedResources.add(ar) + ar.setResourceId("ed4a3a9a-1411-4924-a9ee-61a41871a040") + ar.setResourceType(ResourceType.ALLOTTED_RESOURCE) + ModelInfo arModelInfo = new ModelInfo() + ar.setModelInfo(arModelInfo) + arModelInfo.setModelName("vcpear_tunnelxconn_1111") + arModelInfo.setModelUuid("d99e5442-c5e4-4197-ad8d-54f7ad43dd83") + arModelInfo.setModelInvariantUuid("61c17371-e824-4587-a9bb-21782aa28391") + arModelInfo.setModelVersion("1.0") + arModelInfo.setModelCustomizationUuid("506bb474-b8c2-41fd-aeec-4371c3ef58a4") + arModelInfo.setModelCustomizationName("") + arModelInfo.setModelInstanceName("vcpear_tunnelxconn_1111 0") + arModelInfo.setModelType("") + ar.setResourceInstance(new ResourceInstance()) + HomingSolution homingSolution = new HomingSolution() + ar.setHomingSolution(homingSolution) + homingSolution.setInventoryType(InventoryType.service) + homingSolution.setServiceInstanceId("d600c1c0-ff45-40e4-bf29-45a95fa64556") + homingSolution.setCloudOwner("CloudOwner") + homingSolution.setCloudRegionId("RegionOne") + VnfResource vnf = new VnfResource() + homingSolution.setVnf(vnf) + vnf.setResourceId("cea5e96e-9c67-437c-bf94-2329d277be09") + vnf.setResourceType(ResourceType.VNF) + vnf.setResourceInstance(new ResourceInstance()) + vnf.setHomingSolution(new HomingSolution()) + vnf.setVnfHostname("vnfHostName") + homingSolution.setLicense(new License()) + homingSolution.setRehome(false) + ar.setToscaNodeType("org.openecomp.resource.vf.VcpearTunnelxconn1111") + ar.setAllottedResourceType("TunnelXConnect") + ar.setAllottedResourceRole("TunnelXConn") + ar.setProvidingServiceModelName("org.openecomp.service.VcpesvcVgmux1111") + ar.setProvidingServiceModelInvariantUuid("d5751cb3-b9e9-470b-9c29-76a5e3ea12d0") + ar.setProvidingServiceModelUuid("61b6e96a-f0c6-4f34-a91c-dab3574dd025") + ar.setNfType("TunnelXConn") + ar.setNfRole("TunnelXConn") + + ar = new AllottedResource() + allottedResources.add(ar) + ar.setResourceId("3b1b3686-ccfe-4e7c-9d6b-76419db398f9") + ar.setResourceType(ResourceType.ALLOTTED_RESOURCE) + arModelInfo = new ModelInfo() + ar.setModelInfo(arModelInfo) + arModelInfo.setModelName("vcpear_brg_1111") + arModelInfo.setModelUuid("6b0a5aa5-98d8-455c-8cd1-618a3f1ac859") + arModelInfo.setModelInvariantUuid("531f9aa5-dea4-4958-89ad-ef03f77cbf07") + arModelInfo.setModelVersion("1.0") + arModelInfo.setModelCustomizationUuid("d23ac3fe-ea54-4060-a7c1-ec9178c79620") + arModelInfo.setModelCustomizationName("") + arModelInfo.setModelInstanceName("vcpear_brg_1111 0") + arModelInfo.setModelType("") + ar.setResourceInstance(new ResourceInstance()) + homingSolution = new HomingSolution() + ar.setHomingSolution(homingSolution) + homingSolution.setInventoryType(InventoryType.service) + homingSolution.setServiceInstanceId("bc28ebca-0cc3-4bf8-9ce9-d1524e4bec79") + homingSolution.setCloudOwner("CloudOwner") + homingSolution.setCloudRegionId("RegionOne") + vnf = new VnfResource() + homingSolution.setVnf(vnf) + vnf.setResourceId("65183e95-e6f1-46cb-9315-2da27a24c2b9") + vnf.setResourceType(ResourceType.VNF) + vnf.setResourceInstance(new ResourceInstance()) + vnf.setHomingSolution(new HomingSolution()) + vnf.setVnfHostname("vnfHostName") + homingSolution.setLicense(new License()) + homingSolution.setRehome(false) + ar.setToscaNodeType("org.openecomp.resource.vf.VcpearBrg1111") + ar.setAllottedResourceType("BRG") + ar.setAllottedResourceRole("BRG") + ar.setProvidingServiceModelName("org.openecomp.service.VcpesvcVbrg1111") + ar.setProvidingServiceModelInvariantUuid("6eff53bf-0045-41b0-bd48-b4e1284e5b7a") + ar.setProvidingServiceModelUuid("0e500bca-15ac-42eb-a2f1-4bfd3b2828ff") + ar.setNfType("BRG") + ar.setNfRole("BRG") + + return serviceDecomposition + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy index bbbb82b5aa..4cb21181ec 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy @@ -34,7 +34,7 @@ import org.onap.so.bpmn.mock.FileUtil import org.onap.so.bpmn.vcpe.scripts.GroovyTestBase import static org.assertj.core.api.Assertions.assertThatThrownBy -import static org.mockito.Matchers.anyString +import static org.mockito.ArgumentMatchers.anyString import static org.mockito.Mockito.verify import static org.mockito.Mockito.when import static org.mockito.Mockito.eq diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstanceTest.groovy index 764ceb256a..c2113e2f28 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstanceTest.groovy @@ -34,7 +34,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults -import static org.mockito.Matchers.isA +import static org.mockito.ArgumentMatchers.isA import static org.mockito.Mockito.doThrow import static org.mockito.Mockito.spy import static org.mockito.Mockito.when diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy index d0ded39146..160eee2337 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy @@ -85,10 +85,10 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { // ***** preProcessRequest ***** @Test - @Ignore // 1802 merge public void preProcessRequest() { ExecutionEntity mex = setupMock() def map = setupMap(mex) + initPreProcess(mex) CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() @@ -96,7 +96,6 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { verify(mex).getVariable(DBGFLAG) verify(mex).setVariable("prefix", Prefix) - verify(mex).setVariable("aaiDistDelay", "aaidelay") verify(mex).setVariable("createVcpeServiceRequest", request) verify(mex).setVariable("msoRequestId", "mri") assertEquals("sii", map.get("serviceInstanceId")) @@ -118,6 +117,8 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { def reqinfo = map.get(Prefix+"requestInfo") assertTrue(reqinfo.indexOf("<request-id>mri</") >= 0) assertTrue(reqinfo.indexOf("<source>VID</") >= 0) + + assertTrue(map.containsKey("vfModuleNames")) } @Test @@ -127,7 +128,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { def map = setupMap(mex) initPreProcess(mex) - when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn(null) + when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn(null) CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() @@ -209,7 +210,6 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { .replace('"mdt1"', '"CloudOwner_CloudRegion1"') when(mex.getVariable("bpmnRequest")).thenReturn(req) - when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn("PT5S") when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S") CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() @@ -230,8 +230,6 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { .replace('"mdt1"', '"CloudRegion1_"') when(mex.getVariable("bpmnRequest")).thenReturn(req) - when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn(60) - when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn("PT5S") when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S") CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() @@ -1122,7 +1120,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { private void initPreProcess(ExecutionEntity mex) { when(mex.getVariable(DBGFLAG)).thenReturn("true") when(mex.getVariable("bpmnRequest")).thenReturn(request) - when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn("aaidelay") + when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S") when(mex.getVariable("mso-request-id")).thenReturn("mri") when(mex.getVariable("serviceInstanceId")).thenReturn("sii") when(mex.getVariable("requestAction")).thenReturn("ra") diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java index 4282b0f2bb..8507d9c092 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java @@ -24,7 +24,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java index 0872060d55..c487125ea6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java @@ -23,7 +23,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; @@ -53,4 +53,4 @@ public class CreatePnfEntryInAaiDelegateTest { assertThat(createdEntry.getPnfName()).isEqualTo("testCorrelationId"); assertThat(createdEntry.isInMaint()).isNull(); } -}
\ No newline at end of file +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java index 763a4546e8..8a1cdfa4c0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java @@ -28,8 +28,6 @@ import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; import org.junit.Test; public class GeneratePnfUuidDelegateTest { - private static final String UUID_REGEX = "(?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}$"; - @Test public void execute_shouldSetValidUuidAsPnfUuid() { // given @@ -38,6 +36,6 @@ public class GeneratePnfUuidDelegateTest { // when delegate.execute(execution); // then - assertThat((String) execution.getVariable(PNF_UUID)).matches(UUID_REGEX); + assertThat((String) execution.getVariable(PNF_UUID)).matches(PnfCheckInputs.UUID_REGEX); } -}
\ No newline at end of file +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java index 7a31ae1a67..23c82229fe 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java @@ -30,7 +30,7 @@ import org.mockito.InOrder; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.*; public class InformDmaapClientTest { diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java index d670305a9a..1888831e2e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java @@ -4,8 +4,6 @@ * ================================================================================ * 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 @@ -23,7 +21,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy; +import static org.assertj.core.api.Assertions.assertThatThrownBy; 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; @@ -56,18 +54,6 @@ public class PnfCheckInputsTest { } @Test - public void shouldThrowException_whenCorrelationIdIsEmptyString() { - PnfCheckInputs testedObject = prepareExecutionForCorrelationId(""); - assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); - } - - @Test - public void shouldThrowException_whenTimeoutIsNotSetAndDefaultIsNotDefined() { - PnfCheckInputs testedObject = prepareExecutionForTimeout(null, null); - assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); - } - - @Test public void shouldThrowException_whenTimeoutIsEmptyStringAndDefaultIsNotDefined() { PnfCheckInputs testedObject = prepareExecutionForTimeout(null, ""); assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java index 33b4689629..b30239d9c0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java @@ -25,7 +25,7 @@ package org.onap.so.bpmn.infrastructure.pnf.dmaap; import static org.junit.Assert.*; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json index dc4669e8d9..766d27a26d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json @@ -23,6 +23,7 @@ }, "cloudConfiguration": { + "cloudOwner":"CloudOwner", "lcpCloudRegionId":"mdt1", "tenantId":"8b1df54faa3b49078e3416e21370a3ba" }, @@ -30,11 +31,37 @@ { "subscriptionServiceType":"123456789", "aLaCarte":"false", - "userParams": + "userParams":[ { - "BRG_WAN_MAC_Address" : "brgmac" + "name":"BRG_WAN_MAC_Address", + "value":"brgmac" + }, + { + "name":"Customer_Location", + "value":{ + "customerLatitude":"32.897480", + "customerLongitude":"-97.040443", + "customerName":"some_company" + } + }, + { + "name":"Homing_Solution", + "value":"sniro" + }, + { + "name":"VfModuleNames", + "value":[ + { + "VfModuleModelInvariantUuid":"c0e70c86-9813-4441-93c7-ad356a9a8d3b", + "VfModuleName":"VGWA:f4:56:56:56:%" + }, + { + "VfModuleModelInvariantUuid":"5366deab-be06-44c7-b4f7-77e657b78b25", + "VfModuleName":"VGWB:a9:18:18:18:%" + } + ] } + ] } - } } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn index fe2c8928d8..8cde4f6c56 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn @@ -38,7 +38,7 @@ dcsi.prepareUpdateAfterActivateSDNCResource(execution)</bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn index 6a7cf8160a..6be6cc9899 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn @@ -46,7 +46,7 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> @@ -82,7 +82,7 @@ dcsi.doCreateE2ESIin3rdONAP(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> @@ -199,7 +199,7 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> @@ -311,7 +311,7 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateActivateSDNCResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateActivateSDNCResource.bpmn index 29d7a11175..5f4f964008 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateActivateSDNCResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateActivateSDNCResource.bpmn @@ -79,7 +79,7 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> @@ -101,7 +101,7 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> @@ -147,7 +147,7 @@ dcsi.prepareUpdateAfterActivateSDNCResource(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn index 6f73b46e2e..04ff48d4ed 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.16.2"> <bpmn:process id="CreateCustomE2EServiceInstance" name="CreateCustomE2EServiceInstance" isExecutable="true"> <bpmn:startEvent id="StartEvent_00qj6ro" name="Create SI Start Flow"> <bpmn:outgoing>SequenceFlow_0s2spoq</bpmn:outgoing> @@ -8,9 +8,9 @@ <bpmn:scriptTask id="ScriptTask_0u3lw39" name="Handle Unexpected Error" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1dsbjjb</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1yay321</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.common.scripts.* + <bpmn:script>import org.onap.so.bpmn.common.scripts.* ExceptionUtil ex = new ExceptionUtil() -ex.processJavaException(execution)]]></bpmn:script> +ex.processJavaException(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:startEvent id="StartEvent_0v1ffn4"> <bpmn:outgoing>SequenceFlow_1dsbjjb</bpmn:outgoing> @@ -54,16 +54,16 @@ ex.processJavaException(execution)]]></bpmn:script> <bpmn:scriptTask id="ScriptTask_1s09c7d" name="Pre Process Incoming Request" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0s2spoq</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0z4faf9</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi= new CreateCustomE2EServiceInstance() -csi.preProcessRequest(execution)]]></bpmn:script> +csi.preProcessRequest(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:scriptTask id="ScriptTask_0ttvn8r" name="Prepare Completion Request" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_14zu6wr</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0je30si</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi = new CreateCustomE2EServiceInstance() -csi.prepareCompletionRequest(execution)]]></bpmn:script> +csi.prepareCompletionRequest(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:callActivity id="CallActivity_02fyxz0" name="Call CompleteMsoProcess" calledElement="CompleteMsoProcess"> <bpmn:extensionElements> @@ -88,9 +88,9 @@ csi.prepareCompletionRequest(execution)]]></bpmn:script> <bpmn:scriptTask id="ScriptTask_0u8o9p2" name="Prepare Fallout Request" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0n9pexp</bpmn:incoming> <bpmn:outgoing>SequenceFlow_01umodj</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi = new CreateCustomE2EServiceInstance() -csi.prepareFalloutRequest(execution)]]></bpmn:script> +csi.prepareFalloutRequest(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:callActivity id="CallActivity_1ang7q8" name="Call FalloutHandler" calledElement="FalloutHandler"> <bpmn:extensionElements> @@ -107,9 +107,9 @@ csi.prepareFalloutRequest(execution)]]></bpmn:script> <bpmn:scriptTask id="ScriptTask_1rn6nqi" name="Send Error Response"> <bpmn:incoming>SequenceFlow_0e1r62n</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0n9pexp</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi = new CreateCustomE2EServiceInstance() -csi.sendSyncError(execution)]]></bpmn:script> +csi.sendSyncError(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_0e1r62n" sourceRef="StartEvent_0dug28e" targetRef="ScriptTask_1rn6nqi" /> <bpmn:sequenceFlow id="SequenceFlow_1ysapam" sourceRef="CallActivity_1ang7q8" targetRef="EndEvent_03wysuk" /> @@ -119,9 +119,9 @@ csi.sendSyncError(execution)]]></bpmn:script> <bpmn:scriptTask id="ScriptTask_0xupxj9" name="Send Sync Ack Response" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_081z8l2</bpmn:incoming> <bpmn:outgoing>SequenceFlow_19eilro</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi = new CreateCustomE2EServiceInstance() -csi.sendSyncResponse(execution)]]></bpmn:script> +csi.sendSyncResponse(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:exclusiveGateway id="ExclusiveGateway_0aqn64l" name="Success?"> <bpmn:incoming>SequenceFlow_0klbpxx</bpmn:incoming> @@ -138,19 +138,19 @@ csi.sendSyncResponse(execution)]]></bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_0yayvrf" sourceRef="CallActivity_02fyxz0" targetRef="EndEvent_0bpd6c0" /> <bpmn:sequenceFlow id="SequenceFlow_0z4faf9" sourceRef="ScriptTask_1s09c7d" targetRef="Task_1tqjch6" /> <bpmn:sequenceFlow id="SequenceFlow_14zu6wr" name="yes" sourceRef="ExclusiveGateway_0aqn64l" targetRef="ScriptTask_0ttvn8r"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") == null}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") == null}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_0je30si" sourceRef="ScriptTask_0ttvn8r" targetRef="CallActivity_02fyxz0" /> <bpmn:sequenceFlow id="SequenceFlow_1fueo69" name="no" sourceRef="ExclusiveGateway_0aqn64l" targetRef="EndEvent_07uk5iy"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") != null}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") != null}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_1euqjsp" sourceRef="Task_1tqjch6" targetRef="Task_19mxcw3" /> <bpmn:scriptTask id="Task_1tqjch6" name="Init Service Operation Status" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0z4faf9</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1euqjsp</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi= new CreateCustomE2EServiceInstance() -csi.prepareInitServiceOperationStatus(execution)]]></bpmn:script> +csi.prepareInitServiceOperationStatus(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:serviceTask id="Task_19mxcw3" name="Update Service Operation Status"> <bpmn:extensionElements> @@ -160,7 +160,7 @@ csi.prepareInitServiceOperationStatus(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> @@ -225,61 +225,61 @@ csi.prepareInitServiceOperationStatus(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0s2spoq_di" bpmnElement="SequenceFlow_0s2spoq"> - <di:waypoint xsi:type="dc:Point" x="30" y="198" /> - <di:waypoint xsi:type="dc:Point" x="115" y="198" /> + <di:waypoint x="30" y="198" /> + <di:waypoint x="115" y="198" /> <bpmndi:BPMNLabel> <dc:Bounds x="27.5" y="177" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_19eilro_di" bpmnElement="SequenceFlow_19eilro"> - <di:waypoint xsi:type="dc:Point" x="710" y="198" /> - <di:waypoint xsi:type="dc:Point" x="751" y="198" /> + <di:waypoint x="710" y="198" /> + <di:waypoint x="751" y="198" /> <bpmndi:BPMNLabel> <dc:Bounds x="685.5" y="177" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0klbpxx_di" bpmnElement="SequenceFlow_0klbpxx"> - <di:waypoint xsi:type="dc:Point" x="851" y="198" /> - <di:waypoint xsi:type="dc:Point" x="903" y="198" /> + <di:waypoint x="851" y="198" /> + <di:waypoint x="903" y="198" /> <bpmndi:BPMNLabel> <dc:Bounds x="832" y="177" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0yayvrf_di" bpmnElement="SequenceFlow_0yayvrf"> - <di:waypoint xsi:type="dc:Point" x="1276" y="238" /> - <di:waypoint xsi:type="dc:Point" x="1276" y="286" /> + <di:waypoint x="1276" y="238" /> + <di:waypoint x="1276" y="286" /> <bpmndi:BPMNLabel> <dc:Bounds x="1246" y="262" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0z4faf9_di" bpmnElement="SequenceFlow_0z4faf9"> - <di:waypoint xsi:type="dc:Point" x="215" y="198" /> - <di:waypoint xsi:type="dc:Point" x="273" y="198" /> + <di:waypoint x="215" y="198" /> + <di:waypoint x="273" y="198" /> <bpmndi:BPMNLabel> <dc:Bounds x="199" y="177" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_14zu6wr_di" bpmnElement="SequenceFlow_14zu6wr"> - <di:waypoint xsi:type="dc:Point" x="953" y="198" /> - <di:waypoint xsi:type="dc:Point" x="990" y="198" /> - <di:waypoint xsi:type="dc:Point" x="990" y="198" /> - <di:waypoint xsi:type="dc:Point" x="1038" y="198" /> + <di:waypoint x="953" y="198" /> + <di:waypoint x="990" y="198" /> + <di:waypoint x="990" y="198" /> + <di:waypoint x="1038" y="198" /> <bpmndi:BPMNLabel> <dc:Bounds x="987" y="195" width="20" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0je30si_di" bpmnElement="SequenceFlow_0je30si"> - <di:waypoint xsi:type="dc:Point" x="1138" y="198" /> - <di:waypoint xsi:type="dc:Point" x="1226" y="198" /> + <di:waypoint x="1138" y="198" /> + <di:waypoint x="1226" y="198" /> <bpmndi:BPMNLabel> <dc:Bounds x="1137" y="183" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1fueo69_di" bpmnElement="SequenceFlow_1fueo69"> - <di:waypoint xsi:type="dc:Point" x="928" y="223" /> - <di:waypoint xsi:type="dc:Point" x="928" y="250" /> - <di:waypoint xsi:type="dc:Point" x="928" y="250" /> - <di:waypoint xsi:type="dc:Point" x="928" y="286" /> + <di:waypoint x="928" y="223" /> + <di:waypoint x="928" y="250" /> + <di:waypoint x="928" y="250" /> + <di:waypoint x="928" y="286" /> <bpmndi:BPMNLabel> <dc:Bounds x="901" y="228" width="15" height="12" /> </bpmndi:BPMNLabel> @@ -321,54 +321,54 @@ csi.prepareInitServiceOperationStatus(execution)]]></bpmn:script> <dc:Bounds x="443" y="434" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1dsbjjb_di" bpmnElement="SequenceFlow_1dsbjjb"> - <di:waypoint xsi:type="dc:Point" x="532" y="727" /> - <di:waypoint xsi:type="dc:Point" x="611" y="727" /> + <di:waypoint x="532" y="727" /> + <di:waypoint x="611" y="727" /> <bpmndi:BPMNLabel> <dc:Bounds x="529.5" y="727" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1yay321_di" bpmnElement="SequenceFlow_1yay321"> - <di:waypoint xsi:type="dc:Point" x="711" y="727" /> - <di:waypoint xsi:type="dc:Point" x="772" y="727" /> + <di:waypoint x="711" y="727" /> + <di:waypoint x="772" y="727" /> <bpmndi:BPMNLabel> <dc:Bounds x="701.5" y="727" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0e1r62n_di" bpmnElement="SequenceFlow_0e1r62n"> - <di:waypoint xsi:type="dc:Point" x="399" y="474" /> - <di:waypoint xsi:type="dc:Point" x="421" y="474" /> - <di:waypoint xsi:type="dc:Point" x="421" y="474" /> - <di:waypoint xsi:type="dc:Point" x="442" y="474" /> + <di:waypoint x="399" y="474" /> + <di:waypoint x="421" y="474" /> + <di:waypoint x="421" y="474" /> + <di:waypoint x="442" y="474" /> <bpmndi:BPMNLabel> <dc:Bounds x="391" y="474" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1ysapam_di" bpmnElement="SequenceFlow_1ysapam"> - <di:waypoint xsi:type="dc:Point" x="898" y="474" /> - <di:waypoint xsi:type="dc:Point" x="942" y="474" /> + <di:waypoint x="898" y="474" /> + <di:waypoint x="942" y="474" /> <bpmndi:BPMNLabel> <dc:Bounds x="875" y="459" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0n9pexp_di" bpmnElement="SequenceFlow_0n9pexp"> - <di:waypoint xsi:type="dc:Point" x="543" y="474" /> - <di:waypoint xsi:type="dc:Point" x="570" y="474" /> - <di:waypoint xsi:type="dc:Point" x="570" y="474" /> - <di:waypoint xsi:type="dc:Point" x="621" y="474" /> + <di:waypoint x="543" y="474" /> + <di:waypoint x="570" y="474" /> + <di:waypoint x="570" y="474" /> + <di:waypoint x="621" y="474" /> <bpmndi:BPMNLabel> <dc:Bounds x="540" y="474" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_01umodj_di" bpmnElement="SequenceFlow_01umodj"> - <di:waypoint xsi:type="dc:Point" x="721" y="474" /> - <di:waypoint xsi:type="dc:Point" x="798" y="474" /> + <di:waypoint x="721" y="474" /> + <di:waypoint x="798" y="474" /> <bpmndi:BPMNLabel> <dc:Bounds x="715.5" y="459" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1euqjsp_di" bpmnElement="SequenceFlow_1euqjsp"> - <di:waypoint xsi:type="dc:Point" x="373" y="198" /> - <di:waypoint xsi:type="dc:Point" x="446" y="198" /> + <di:waypoint x="373" y="198" /> + <di:waypoint x="446" y="198" /> <bpmndi:BPMNLabel> <dc:Bounds x="364.5" y="177" width="90" height="12" /> </bpmndi:BPMNLabel> @@ -380,8 +380,8 @@ csi.prepareInitServiceOperationStatus(execution)]]></bpmn:script> <dc:Bounds x="446" y="158" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_081z8l2_di" bpmnElement="SequenceFlow_081z8l2"> - <di:waypoint xsi:type="dc:Point" x="546" y="198" /> - <di:waypoint xsi:type="dc:Point" x="610" y="198" /> + <di:waypoint x="546" y="198" /> + <di:waypoint x="610" y="198" /> <bpmndi:BPMNLabel> <dc:Bounds x="533" y="177" width="90" height="12" /> </bpmndi:BPMNLabel> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn index 5fd2c69608..29cec8ed1e 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn @@ -93,7 +93,7 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn index a94569c29b..0bdc6dc0bd 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn @@ -62,7 +62,7 @@ dcsi.prepareUpdateBeforeCreateSDNCResource(execution)</bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> @@ -84,7 +84,7 @@ dcsi.prepareUpdateBeforeCreateSDNCResource(execution)</bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService.bpmn index 7413e6df83..54f0947d29 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="CreateVcpeResCustService" name="CreateVcpeResCustService" isExecutable="true"> <bpmn2:scriptTask id="sendSyncAckResponse_ScriptTask" name="Send Sync Ack Response" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> @@ -518,6 +518,7 @@ CreateVcpeResCustService.prepareCreateAllottedResourceBRG(execution)]]></bpmn2:s <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> <camunda:in source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:in source="vfModuleNames" target="vfModuleNames" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_0ws7fjn</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1mkdhw9</bpmn2:outgoing> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn index bfbdc25f18..2dbf12717c 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn @@ -488,6 +488,7 @@ CreateVcpeResCustService.prepareCreateAllottedResourceTXC(execution)]]></bpmn2:s <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> <camunda:in source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:in source="vfModuleNames" target="vfModuleNames" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_0ws7fjn</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1mkdhw9</bpmn2:outgoing> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn index eaf37191d5..cfcd259d7c 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn @@ -62,7 +62,7 @@ csi.sendSyncResponse(execution)</bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn index 25fd6af574..f6dcff4435 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn @@ -46,7 +46,7 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> @@ -82,7 +82,7 @@ dcsi.doDeleteE2ESIin3rdONAP(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> @@ -192,7 +192,7 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> @@ -303,7 +303,7 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn index 2d68d650c5..7010442b5d 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn @@ -152,7 +152,7 @@ csi.prepareInitServiceOperationStatus(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn index 73d38b383c..7d9a9e2b5d 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn @@ -92,7 +92,7 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn index 80fcc1762e..c2d4de3973 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn @@ -58,7 +58,7 @@ dcsi.prepareUpdateBeforeDeleteSDNCResource(execution)</bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> @@ -80,7 +80,7 @@ dcsi.prepareUpdateBeforeDeleteSDNCResource(execution)</bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn index 1be30d62e4..e2488fda6a 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn @@ -136,7 +136,7 @@ csi.sendSyncError(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> @@ -246,7 +246,7 @@ csi.prepareInitServiceOperationStatus(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> @@ -270,7 +270,7 @@ csi.prepareInitServiceOperationStatus(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn index 01040ba914..eccb9486dd 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn @@ -123,7 +123,7 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn index c699f911d0..31174a0b3e 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn @@ -284,7 +284,7 @@ ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> @@ -317,7 +317,7 @@ ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> @@ -350,7 +350,7 @@ ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> @@ -381,7 +381,7 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter> @@ -404,7 +404,7 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn index b5988538e3..016aaa20d2 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="DoCreateVnfAndModules" name="DoCreateVnfAndModules" isExecutable="true"> <bpmn:startEvent id="StartEvent_1"> <bpmn:outgoing>SequenceFlow_0o4vuzt</bpmn:outgoing> @@ -42,7 +42,8 @@ doCreateVnfAndModules.preProcessRequest(execution)]]></bpmn:script> <camunda:in source="false" target="usePreload" /> <camunda:in source="aLaCarte" target="aLaCarte" /> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1hf7k7q</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0tbhtk8</bpmn:incoming> + <bpmn:incoming>SequenceFlow_10nwzbe</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1ixcnb6</bpmn:outgoing> </bpmn:callActivity> <bpmn:sequenceFlow id="SequenceFlow_0o4vuzt" sourceRef="StartEvent_1" targetRef="PreProcessRequest" /> @@ -79,6 +80,7 @@ doCreateVnfAndModules.preProcessRequest(execution)]]></bpmn:script> <camunda:in source="aLaCarte" target="aLaCarte" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1lh21yl</bpmn:incoming> + <bpmn:incoming>SequenceFlow_12ffqm1</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1llbx0k</bpmn:outgoing> </bpmn:callActivity> <bpmn:scriptTask id="Task_1lfmdks" name="Validate Create Add-On VF Module Response" scriptFormat="groovy"> @@ -132,7 +134,7 @@ doCreateVnfAndModules.validateAddOnModule(execution)]]></bpmn:script> <camunda:in source="vnfResourceDecomposition" target="vnfResourceDecomposition" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_19ohb1a</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_07u8e3l</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0oxfrrr</bpmn:outgoing> </bpmn:callActivity> <bpmn:scriptTask id="PreProcessAddOnModule" name="PreProcess Add-On Module" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0jz6bqn</bpmn:incoming> @@ -157,12 +159,11 @@ doCreateVnfAndModules.queryCatalogDB(execution)]]></bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_0jz6bqn" name="yes" sourceRef="ExclusiveGateway_1vyqr5o" targetRef="PreProcessAddOnModule"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("addOnModulesDeployed") < execution.getVariable("addOnModulesToDeploy")}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_0kld3qt" name="yes" sourceRef="ExclusiveGateway_1hx9s0y" targetRef="GenerateAddOnModuleName"> + <bpmn:sequenceFlow id="SequenceFlow_0kld3qt" name="yes" sourceRef="ExclusiveGateway_1hx9s0y" targetRef="ExclusiveGateway_03anzqd"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("instancesOfThisModuleDeployed") < execution.getVariable("initialCount")}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_1mguf2m" sourceRef="Task_1lfmdks" targetRef="ExclusiveGateway_1hx9s0y" /> <bpmn:sequenceFlow id="SequenceFlow_1vrogpr" name="no" sourceRef="ExclusiveGateway_1hx9s0y" targetRef="PostProcessAddOnModule" /> - <bpmn:sequenceFlow id="SequenceFlow_1hf7k7q" sourceRef="GenerateBaseModuleName" targetRef="CreateBaseVfModule" /> <bpmn:callActivity id="GenerateBaseModuleName" name="Generate Base Module Name" calledElement="GenerateVfModuleName"> <bpmn:extensionElements> <camunda:in source="vnfId" target="vnfId" /> @@ -173,8 +174,8 @@ doCreateVnfAndModules.queryCatalogDB(execution)]]></bpmn:script> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_07u8e3l</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1hf7k7q</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_19ecf9p</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0tbhtk8</bpmn:outgoing> </bpmn:callActivity> <bpmn:callActivity id="GenerateAddOnModuleName" name="Generate Add-On Module Name" calledElement="GenerateVfModuleName"> <bpmn:extensionElements> @@ -186,7 +187,7 @@ doCreateVnfAndModules.queryCatalogDB(execution)]]></bpmn:script> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0kld3qt</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0ulldxo</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1lh21yl</bpmn:outgoing> </bpmn:callActivity> <bpmn:sequenceFlow id="SequenceFlow_1lh21yl" sourceRef="GenerateAddOnModuleName" targetRef="CreateAddOnVfModule" /> @@ -240,7 +241,6 @@ dcvam.postProcessRollback(execution)]]></bpmn:script> </bpmn:startEvent> </bpmn:subProcess> <bpmn:sequenceFlow id="SequenceFlow_19ohb1a" sourceRef="QueryCatalogDB" targetRef="CreateVNF" /> - <bpmn:sequenceFlow id="SequenceFlow_07u8e3l" sourceRef="CreateVNF" targetRef="GenerateBaseModuleName" /> <bpmn:sequenceFlow id="SequenceFlow_0j52dxv" sourceRef="PostProcessAddOnModule" targetRef="ExclusiveGateway_1vyqr5o" /> <bpmn:scriptTask id="PostProcessAddOnModule" name="PostProcess Add-On Module" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1vrogpr</bpmn:incoming> @@ -250,9 +250,9 @@ def doCreateVnfAndModules = new DoCreateVnfAndModules() doCreateVnfAndModules.postProcessAddOnModule(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_1t407j7" sourceRef="Task_1mrb29r" targetRef="Task_0qrf3e8" /> - <bpmn:sequenceFlow id="SequenceFlow_0baw1tl" sourceRef="Task_0qrf3e8" targetRef="GenerateBaseModuleName" /> + <bpmn:sequenceFlow id="SequenceFlow_0baw1tl" sourceRef="Task_0qrf3e8" targetRef="ExclusiveGateway_06ccv8x" /> <bpmn:scriptTask id="Task_1mrb29r" name="Create Platform" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_07u8e3l</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0oxfrrr</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1t407j7</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def doCreateVnfAndModules = new DoCreateVnfAndModules() @@ -265,6 +265,26 @@ doCreateVnfAndModules.createPlatform(execution)]]></bpmn:script> def doCreateVnfAndModules = new DoCreateVnfAndModules() doCreateVnfAndModules.createLineOfBusiness(execution)]]></bpmn:script> </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_06ccv8x" name="Need to Generate Name?" default="SequenceFlow_10nwzbe"> + <bpmn:incoming>SequenceFlow_0baw1tl</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_19ecf9p</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_10nwzbe</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_19ecf9p" name="yes" sourceRef="ExclusiveGateway_06ccv8x" targetRef="GenerateBaseModuleName"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("baseVfModuleName") == null}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0tbhtk8" sourceRef="GenerateBaseModuleName" targetRef="CreateBaseVfModule" /> + <bpmn:sequenceFlow id="SequenceFlow_10nwzbe" name="no" sourceRef="ExclusiveGateway_06ccv8x" targetRef="CreateBaseVfModule" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_03anzqd" name="Need to Generate Name?" default="SequenceFlow_12ffqm1"> + <bpmn:incoming>SequenceFlow_0kld3qt</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ulldxo</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_12ffqm1</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0ulldxo" name="yes" sourceRef="ExclusiveGateway_03anzqd" targetRef="GenerateAddOnModuleName"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("addOnVfModuleName") == null}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_12ffqm1" name="no" sourceRef="ExclusiveGateway_03anzqd" targetRef="CreateAddOnVfModule" /> + <bpmn:sequenceFlow id="SequenceFlow_0oxfrrr" sourceRef="CreateVNF" targetRef="Task_1mrb29r" /> </bpmn:process> <bpmn:error id="Error_1" name="Java Lang Exception" errorCode="java.lang.Exception" /> <bpmn:error id="Error_2" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> @@ -303,16 +323,16 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]></bpmn:script> <dc:Bounds x="2239" y="57" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1h41bs7_di" bpmnElement="EndEvent_0v6povc"> - <dc:Bounds x="2362" y="147" width="36" height="36" /> + <dc:Bounds x="1524" y="37" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2380" y="183" width="0" height="0" /> + <dc:Bounds x="1497" y="73" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1llbx0k_di" bpmnElement="SequenceFlow_1llbx0k"> <di:waypoint xsi:type="dc:Point" x="2200" y="97" /> <di:waypoint xsi:type="dc:Point" x="2239" y="97" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2220" y="82" width="0" height="0" /> + <dc:Bounds x="2175" y="82" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_1vyqr5o_di" bpmnElement="ExclusiveGateway_1vyqr5o" isMarkerVisible="true"> @@ -323,11 +343,9 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]></bpmn:script> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_132bohl_di" bpmnElement="SequenceFlow_132bohl"> <di:waypoint xsi:type="dc:Point" x="1542" y="140" /> - <di:waypoint xsi:type="dc:Point" x="1542" y="36" /> - <di:waypoint xsi:type="dc:Point" x="2380" y="36" /> - <di:waypoint xsi:type="dc:Point" x="2380" y="147" /> + <di:waypoint xsi:type="dc:Point" x="1542" y="73" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1962" y="21" width="16" height="12" /> + <dc:Bounds x="1548" y="98.99999999999997" width="16" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_0zr4ioh_di" bpmnElement="CreateVNF"> @@ -356,10 +374,10 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]></bpmn:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0kld3qt_di" bpmnElement="SequenceFlow_0kld3qt"> <di:waypoint xsi:type="dc:Point" x="1869" y="140" /> - <di:waypoint xsi:type="dc:Point" x="1869" y="89" /> - <di:waypoint xsi:type="dc:Point" x="1952" y="89" /> + <di:waypoint xsi:type="dc:Point" x="1869" y="97" /> + <di:waypoint xsi:type="dc:Point" x="1974" y="97" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1886" y="96" width="16" height="12" /> + <dc:Bounds x="1890.6265060240964" y="103.99999999999983" width="20" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1mguf2m_di" bpmnElement="SequenceFlow_1mguf2m"> @@ -377,27 +395,21 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]></bpmn:script> <di:waypoint xsi:type="dc:Point" x="1869" y="301" /> <di:waypoint xsi:type="dc:Point" x="1751" y="301" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1878" y="247" width="14" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1hf7k7q_di" bpmnElement="SequenceFlow_1hf7k7q"> - <di:waypoint xsi:type="dc:Point" x="1191" y="165" /> - <di:waypoint xsi:type="dc:Point" x="1239" y="165" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1215" y="150" width="0" height="0" /> + <dc:Bounds x="1878" y="247" width="15" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_0rz8zl9_di" bpmnElement="GenerateBaseModuleName"> - <dc:Bounds x="1091" y="125" width="100" height="80" /> + <dc:Bounds x="1077" y="245" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0otq8mo_di" bpmnElement="GenerateAddOnModuleName"> - <dc:Bounds x="1952" y="57" width="100" height="80" /> + <dc:Bounds x="1949" y="-53" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1lh21yl_di" bpmnElement="SequenceFlow_1lh21yl"> - <di:waypoint xsi:type="dc:Point" x="2052" y="97" /> - <di:waypoint xsi:type="dc:Point" x="2100" y="97" /> + <di:waypoint xsi:type="dc:Point" x="2049" y="-13" /> + <di:waypoint xsi:type="dc:Point" x="2150" y="-13" /> + <di:waypoint xsi:type="dc:Point" x="2150" y="57" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2076" y="82" width="0" height="0" /> + <dc:Bounds x="2054.5" y="-28" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_12x4dvf_di" bpmnElement="SequenceFlow_12x4dvf"> @@ -485,13 +497,6 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]></bpmn:script> <dc:Bounds x="546" y="140" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_07u8e3l_di" bpmnElement="SequenceFlow_07u8e3l"> - <di:waypoint xsi:type="dc:Point" x="674" y="165" /> - <di:waypoint xsi:type="dc:Point" x="742" y="165" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="708" y="150" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0j52dxv_di" bpmnElement="SequenceFlow_0j52dxv"> <di:waypoint xsi:type="dc:Point" x="1651" y="301" /> <di:waypoint xsi:type="dc:Point" x="1543" y="301" /> @@ -512,9 +517,9 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]></bpmn:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0baw1tl_di" bpmnElement="SequenceFlow_0baw1tl"> <di:waypoint xsi:type="dc:Point" x="1016" y="165" /> - <di:waypoint xsi:type="dc:Point" x="1091" y="165" /> + <di:waypoint xsi:type="dc:Point" x="1100" y="165" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1054" y="150" width="0" height="0" /> + <dc:Bounds x="1013" y="150" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0i9vj5o_di" bpmnElement="Task_1mrb29r"> @@ -523,6 +528,63 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]></bpmn:script> <bpmndi:BPMNShape id="ScriptTask_0stghuy_di" bpmnElement="Task_0qrf3e8"> <dc:Bounds x="916" y="125" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_06ccv8x_di" bpmnElement="ExclusiveGateway_06ccv8x" isMarkerVisible="true"> + <dc:Bounds x="1102" y="140" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1083" y="102" width="87" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_19ecf9p_di" bpmnElement="SequenceFlow_19ecf9p"> + <di:waypoint xsi:type="dc:Point" x="1127" y="190" /> + <di:waypoint xsi:type="dc:Point" x="1127" y="215" /> + <di:waypoint xsi:type="dc:Point" x="1127" y="215" /> + <di:waypoint xsi:type="dc:Point" x="1127" y="245" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1132" y="209" width="20" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0tbhtk8_di" bpmnElement="SequenceFlow_0tbhtk8"> + <di:waypoint xsi:type="dc:Point" x="1177" y="285" /> + <di:waypoint xsi:type="dc:Point" x="1289" y="285" /> + <di:waypoint xsi:type="dc:Point" x="1289" y="205" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1233" y="264" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_10nwzbe_di" bpmnElement="SequenceFlow_10nwzbe"> + <di:waypoint xsi:type="dc:Point" x="1152" y="165" /> + <di:waypoint xsi:type="dc:Point" x="1239" y="165" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1188" y="144" width="15" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_03anzqd_di" bpmnElement="ExclusiveGateway_03anzqd" isMarkerVisible="true"> + <dc:Bounds x="1973.884115884116" y="71.89710289710288" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1957" y="126" width="87" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ulldxo_di" bpmnElement="SequenceFlow_0ulldxo"> + <di:waypoint xsi:type="dc:Point" x="1999" y="72" /> + <di:waypoint xsi:type="dc:Point" x="1999" y="27" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2004" y="44" width="20" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_12ffqm1_di" bpmnElement="SequenceFlow_12ffqm1"> + <di:waypoint xsi:type="dc:Point" x="2024" y="97" /> + <di:waypoint xsi:type="dc:Point" x="2100" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2055" y="76" width="15" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0oxfrrr_di" bpmnElement="SequenceFlow_0oxfrrr"> + <di:waypoint xsi:type="dc:Point" x="674" y="165" /> + <di:waypoint xsi:type="dc:Point" x="742" y="165" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="708" y="144" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn index 2e12dd3b96..1b02fd772d 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn @@ -99,7 +99,7 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn index 2df19abf68..cc927b240b 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn @@ -245,7 +245,7 @@ ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> @@ -278,7 +278,7 @@ ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> @@ -310,7 +310,7 @@ ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> @@ -349,7 +349,7 @@ ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> @@ -380,7 +380,7 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn index 6084f570ce..9f9d58fa19 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn @@ -66,7 +66,7 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter> @@ -206,12 +206,12 @@ dcsi.postDecomposeService(execution)]]></bpmn:script> <bpmn:scriptTask id="ScriptTask_0f3tjbn" name="prepare update service operation status" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0h5c1bd</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1ab3vex</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* execution.setVariable("progress", "100") execution.setVariable("result", "finished") execution.setVariable("operationContent", "No actual resoure in service instance") def csi= new DoDeleteE2EServiceInstance() -csi.prepareUpdateServiceOperationStatus(execution)</bpmn:script> +csi.prepareUpdateServiceOperationStatus(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0hrkmxb" name="End Delete Process"> <bpmn:outgoing>SequenceFlow_0h5c1bd</bpmn:outgoing> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn index fe5e93cbec..16acb0d7e1 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn @@ -119,7 +119,7 @@ ddrs.preProcessRequest(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn index fa8a2213b0..dddbe18ba5 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn @@ -30,7 +30,7 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn index 8383ccbd1f..785db75fa1 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn @@ -67,7 +67,7 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter> diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml index becb66a6dc..0243ce8ae6 100644 --- a/bpmn/so-bpmn-tasks/pom.xml +++ b/bpmn/so-bpmn-tasks/pom.xml @@ -121,6 +121,11 @@ <version>${project.version}</version> </dependency> <dependency> + <groupId>org.onap.so.adapters</groupId> + <artifactId>mso-adapter-utils</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> <groupId>org.onap.sdnc.northbound</groupId> <artifactId>generic-resource-api-client</artifactId> <version>1.5.0-SNAPSHOT</version> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java index e83c27c400..92b4e211d5 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java @@ -404,9 +404,9 @@ public class SniroHomingV2 { for(Candidate c:required){ org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate(); org.onap.so.client.sniro.beans.CandidateType type = new org.onap.so.client.sniro.beans.CandidateType(); - type.setName(c.getCandidateType().getName()); - can.setCandidateType(type); - can.setCandidates(c.getCandidates()); + type.setName(c.getIdentifierType().getName()); + can.setIdentifierType(type); + can.setIdentifiers(c.getIdentifiers()); can.setCloudOwner(c.getCloudOwner()); cans.add(can); } @@ -417,9 +417,9 @@ public class SniroHomingV2 { for(Candidate c:excluded){ org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate(); org.onap.so.client.sniro.beans.CandidateType type = new org.onap.so.client.sniro.beans.CandidateType(); - type.setName(c.getCandidateType().getName()); - can.setCandidateType(type); - can.setCandidates(c.getCandidates()); + type.setName(c.getIdentifierType().getName()); + can.setIdentifierType(type); + can.setIdentifiers(c.getIdentifiers()); can.setCloudOwner(c.getCloudOwner()); cans.add(can); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java index 4a3cb01b74..f47781082d 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java @@ -22,11 +22,13 @@ package org.onap.so.bpmn.infrastructure.aai.tasks; import java.util.Arrays; import java.util.List; +import java.util.Optional; +import java.util.TreeSet; +import java.util.UUID; import java.util.stream.Collectors; import org.camunda.bpm.engine.delegate.BpmnError; import org.onap.so.bpmn.common.BuildingBlockExecution; -import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; @@ -35,6 +37,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; @@ -44,6 +47,9 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.aai.AAIObjectPlurals; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIConfigurationResources; @@ -53,9 +59,10 @@ import org.onap.so.client.orchestration.AAIVfModuleResources; import org.onap.so.client.orchestration.AAIVnfResources; import org.onap.so.client.orchestration.AAIVolumeGroupResources; import org.onap.so.client.orchestration.AAIVpnBindingResources; -import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @@ -64,8 +71,13 @@ import org.springframework.stereotype.Component; public class AAICreateTasks { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAICreateTasks.class); + private static final Logger logger = LoggerFactory.getLogger(AAICreateTasks.class.getName()); + private static final String networkTypeProvider = "PROVIDER"; private static String NETWORK_COLLECTION_NAME = "networkCollectionName"; + private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList"; + private static String HEAT_STACK_ID = "heatStackId"; + private static String NETWORK_POLICY_FQDN_PARAM = "network-policy-fqdn"; @Autowired private AAIServiceInstanceResources aaiSIResources; @Autowired @@ -233,6 +245,11 @@ public class AAICreateTasks { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + int moduleIndex = 0; + if (vfModule.getModelInfoVfModule() != null && !Boolean.TRUE.equals(vfModule.getModelInfoVfModule().getIsBaseBoolean())) { + moduleIndex = this.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, vfModule); + } + vfModule.setModuleIndex(moduleIndex); aaiVfModuleResources.createVfModule(vfModule, vnf); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -432,4 +449,95 @@ public class AAICreateTasks { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + + public void createNetworkPolicies(BuildingBlockExecution execution) { + try{ + String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST); + if (fqdns != null && !fqdns.isEmpty()) { + String fqdnList[] = fqdns.split(","); + int fqdnCount = fqdnList.length; + if (fqdnCount > 0) { + for (int i=0; i < fqdnCount; i++) { + String fqdn = fqdnList[i]; + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY); + uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn); + Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy = aaiNetworkResources.getNetworkPolicy(uri); + if(!oNetPolicy.isPresent()) { + msoLogger.debug("This network policy FQDN is not in AAI yet: " + fqdn); + String networkPolicyId = UUID.randomUUID().toString(); + msoLogger.debug("Adding network-policy with network-policy-id " + networkPolicyId); + NetworkPolicy networkPolicy = new NetworkPolicy(); + networkPolicy.setNetworkPolicyId(networkPolicyId); + networkPolicy.setNetworkPolicyFqdn(fqdn); + networkPolicy.setHeatStackId(execution.getVariable(HEAT_STACK_ID)); + + aaiNetworkResources.createNetworkPolicy(networkPolicy); + } + } + } + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * Groups existing vf modules by the model uuid of our new vf module and returns the lowest unused index + * + * if we have a module type A, and there are 3 instances of those, + * and then module type B has 2 instances, if we are adding a new module type A, + * the vf-module-index should be 3 assuming contiguous indices (not 5, or 2) + * + */ + protected int getLowestUnusedVfModuleIndexFromAAIVnfResponse(GenericVnf genericVnf, VfModule newVfModule) { + + String newVfModuleModelInvariantUUID = null; + if (newVfModule.getModelInfoVfModule() != null) { + newVfModuleModelInvariantUUID = newVfModule.getModelInfoVfModule().getModelInvariantUUID(); + } + + + if (genericVnf != null && genericVnf.getVfModules() != null && !genericVnf.getVfModules().isEmpty()) { + List<VfModule> modules = genericVnf.getVfModules().stream().filter(item -> !item.getVfModuleId().equals(newVfModule.getVfModuleId())).collect(Collectors.toList()); + TreeSet<Integer> moduleIndices = new TreeSet<>(); + int nullIndexFound = 0; + for (VfModule vfModule : modules) { + if (vfModule.getModelInfoVfModule() != null) { + if (vfModule.getModelInfoVfModule().getModelInvariantUUID().equals(newVfModuleModelInvariantUUID)) { + if (vfModule.getModuleIndex() != null) { + moduleIndices.add(vfModule.getModuleIndex()); + } else { + nullIndexFound++; + logger.warn("Found null index for vf-module-id {} and model-invariant-uuid {}", vfModule.getVfModuleId(), vfModule.getModelInfoVfModule().getModelInvariantUUID()); + } + } + } + } + + return calculateUnusedIndex(moduleIndices, nullIndexFound); + } else { + return 0; + } + } + + protected int calculateUnusedIndex(TreeSet<Integer> moduleIndices, int nullIndexFound) { + //pad array with nulls + Integer[] temp = new Integer[moduleIndices.size() + nullIndexFound]; + Integer[] array = moduleIndices.toArray(temp); + int result = 0; + //when a null is found skip that potential value + //effectively creates something like, [0,1,3,null,null] -> [0,1,null(2),3,null(4)] + for (int i=0; i < array.length; i++, result++) { + if (Integer.valueOf(result) != array[i]) { + if (nullIndexFound > 0) { + nullIndexFound--; + i--; + } else { + break; + } + } + } + + return result; + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java index a00806a19c..8f0334e462 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java @@ -21,16 +21,23 @@ package org.onap.so.bpmn.infrastructure.aai.tasks; +import java.util.Optional; +import java.util.UUID; + import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.aai.AAIObjectPlurals; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIConfigurationResources; import org.onap.so.client.orchestration.AAINetworkResources; @@ -38,11 +45,16 @@ import org.onap.so.client.orchestration.AAIServiceInstanceResources; import org.onap.so.client.orchestration.AAIVfModuleResources; import org.onap.so.client.orchestration.AAIVnfResources; import org.onap.so.client.orchestration.AAIVolumeGroupResources; +import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class AAIDeleteTasks { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIDeleteTasks.class); + + private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList"; + private static String NETWORK_POLICY_FQDN_PARAM = "network-policy-fqdn"; @Autowired private ExceptionBuilder exceptionUtil; @@ -145,4 +157,30 @@ public class AAIDeleteTasks { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + + public void deleteNetworkPolicies(BuildingBlockExecution execution) { + try{ + String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST); + if (fqdns != null && !fqdns.isEmpty()) { + String fqdnList[] = fqdns.split(","); + int fqdnCount = fqdnList.length; + if (fqdnCount > 0) { + for (int i=0; i < fqdnCount; i++) { + String fqdn = fqdnList[i]; + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY); + uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn); + Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy = aaiNetworkResources.getNetworkPolicy(uri); + if(oNetPolicy.isPresent()) { + String networkPolicyId = oNetPolicy.get().getNetworkPolicyId(); + msoLogger.debug("Deleting network-policy with network-policy-id " + networkPolicyId); + + aaiNetworkResources.deleteNetworkPolicy(networkPolicyId); + } + } + } + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java index ed6379a6a4..5176bee0d6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -449,4 +449,53 @@ public class AAIUpdateTasks { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + + public void updateIpv4OamAddressVnf(BuildingBlockExecution execution) { + try { + String ipv4OamAddress = execution.getVariable("oamManagementV4Address"); + if (ipv4OamAddress != null) { + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf copiedGenericVnf = genericVnf.shallowCopyId(); + + genericVnf.setIpv4OamAddress(ipv4OamAddress); + copiedGenericVnf.setIpv4OamAddress(ipv4OamAddress); + + aaiVnfResources.updateObjectVnf(copiedGenericVnf); + } + } catch(Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void updateManagementV6AddressVnf(BuildingBlockExecution execution) { + try { + String managementV6Address = execution.getVariable("oamManagementV6Address"); + if (managementV6Address != null) { + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf copiedGenericVnf = genericVnf.shallowCopyId(); + + genericVnf.setManagementV6Address(managementV6Address); + copiedGenericVnf.setManagementV6Address(managementV6Address); + + aaiVnfResources.updateObjectVnf(copiedGenericVnf); + } + } catch(Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void updateContrailServiceInstanceFqdnVfModule(BuildingBlockExecution execution) { + try { + String contrailServiceInstanceFqdn = execution.getVariable("contrailServiceInstanceFqdn"); + if (contrailServiceInstanceFqdn != null) { + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + vfModule.setContrailServiceInstanceFqdn(contrailServiceInstanceFqdn); + aaiVfModuleResources.updateContrailServiceInstanceFqdnVfModule(vfModule, vnf); + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + }
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java index 94eead2d05..acef0cb354 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java @@ -84,6 +84,7 @@ public class ExecuteActivity implements JavaDelegate { variables.put("buildingBlock", executeBuildingBlock); variables.put("mso-request-id", requestId); variables.put("retryCount", 1); + variables.put("aLaCarte", true); ProcessInstanceWithVariables buildingBlockResult = runtimeService.createProcessInstanceByKey("ExecuteBuildingBlock").setVariables(variables).executeWithVariablesInReturn(); VariableMap variableMap = buildingBlockResult.getVariables(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java index d821223507..fec7e8456f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.adapter.network.tasks; import java.io.StringReader; @@ -15,6 +35,9 @@ import org.onap.so.adapters.nwrest.CreateNetworkResponse; import org.onap.so.adapters.nwrest.DeleteNetworkError; import org.onap.so.adapters.nwrest.DeleteNetworkRequest; import org.onap.so.adapters.nwrest.DeleteNetworkResponse; +import org.onap.so.adapters.nwrest.UpdateNetworkError; +import org.onap.so.adapters.nwrest.UpdateNetworkRequest; +import org.onap.so.adapters.nwrest.UpdateNetworkResponse; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.NetworkAdapterResources; import org.slf4j.Logger; @@ -68,8 +91,8 @@ public class NetworkAdapterRestV1 { throw new Exception("No Network Request was created. networkAdapterRequest was null."); } } catch (Exception ex) { - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex.getStackTrace().toString()); - } + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex); + } } public void processCallback (DelegateExecution execution) { @@ -95,6 +118,14 @@ public class NetworkAdapterRestV1 { DeleteNetworkResponse deleteNetworkResponse = (DeleteNetworkResponse) unmarshalXml(callback, DeleteNetworkResponse.class); execution.setVariable("deleteNetworkResponse", deleteNetworkResponse); } + } else if (networkAdapterRequest instanceof UpdateNetworkRequest) { + if (callback.contains("updateNetworkError")) { + UpdateNetworkError updateNetworkError = (UpdateNetworkError) unmarshalXml(callback, UpdateNetworkError.class); + throw new Exception(updateNetworkError.getMessage()); + } else { + UpdateNetworkResponse updateNetworkResponse = (UpdateNetworkResponse) unmarshalXml(callback, UpdateNetworkResponse.class); + execution.setVariable("updateNetworkResponse", updateNetworkResponse); + } } } } catch (Exception e) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java index f1a9e955b6..0851dc9d95 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java @@ -26,6 +26,7 @@ import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse; import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse; import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; @@ -47,10 +48,18 @@ import javax.xml.bind.Unmarshaller; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.sax.SAXSource; import java.io.StringReader; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; @Component public class VnfAdapterImpl { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterCreateTasks.class); + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterImpl.class); + private static final String CONTRAIL_SERVICE_INSTANCE_FQDN = "contrailServiceInstanceFqdn"; + private static final String OAM_MANAGEMENT_V4_ADDRESS = "oamManagementV4Address"; + private static final String OAM_MANAGEMENT_V6_ADDRESS = "oamManagementV6Address"; + private static final String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList"; @Autowired private ExtractPojosForBB extractPojosForBB; @@ -65,6 +74,10 @@ public class VnfAdapterImpl { execution.setVariable("mso-request-id", gBBInput.getRequestContext().getMsoRequestId()); execution.setVariable("mso-service-instance-id", serviceInstance.getServiceInstanceId()); execution.setVariable("heatStackId", null); + execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, null); + execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, null); + execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, null); + execution.setVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST, null); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -79,15 +92,36 @@ public class VnfAdapterImpl { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); String heatStackId = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleStackId(); if(!StringUtils.isEmpty(heatStackId)) { - vfModule.setHeatStackId(heatStackId); + vfModule.setHeatStackId(heatStackId); execution.setVariable("heatStackId", heatStackId); } + Map<String,String> vfModuleOutputs = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleOutputs(); + if (vfModuleOutputs != null) { + processVfModuleOutputs(execution, vfModuleOutputs); + } } else if(vnfRestResponse instanceof DeleteVfModuleResponse) { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); Boolean vfModuleDelete = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleDeleted(); if(null!= vfModuleDelete && vfModuleDelete) { vfModule.setHeatStackId(null); execution.setVariable("heatStackId", null); + Map<String,String> vfModuleOutputs = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleOutputs(); + if (vfModuleOutputs != null) { + processVfModuleOutputs(execution, vfModuleOutputs); + if (execution.getVariable(OAM_MANAGEMENT_V4_ADDRESS) != null) { + genericVnf.setIpv4OamAddress(""); + execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, ""); + } + if (execution.getVariable(OAM_MANAGEMENT_V6_ADDRESS) != null) { + genericVnf.setManagementV6Address(""); + execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, ""); + } + if (execution.getVariable(CONTRAIL_SERVICE_INSTANCE_FQDN) != null) { + vfModule.setContrailServiceInstanceFqdn(""); + execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, ""); + } + } } } else if(vnfRestResponse instanceof CreateVolumeGroupResponse) { VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); @@ -108,7 +142,7 @@ public class VnfAdapterImpl { } } } catch (Exception ex) { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -133,4 +167,49 @@ public class VnfAdapterImpl { throw new MarshallerException("Error parsing VNF Adapter response. " + e.getMessage(), MsoLogger.ErrorCode.SchemaError.getValue(), e); } } + + private void processVfModuleOutputs(BuildingBlockExecution execution, Map<String,String> vfModuleOutputs) { + if (vfModuleOutputs == null) { + return; + } + try { + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + List<String> contrailNetworkPolicyFqdnList = new ArrayList<String>(); + Iterator<String> keys = vfModuleOutputs.keySet().iterator(); + while (keys.hasNext()) { + String key = keys.next(); + if (key.equals("contrail-service-instance-fqdn")) { + String contrailServiceInstanceFqdn = vfModuleOutputs.get(key); + msoLogger.debug("Obtained contrailServiceInstanceFqdn: " + contrailServiceInstanceFqdn); + vfModule.setContrailServiceInstanceFqdn(contrailServiceInstanceFqdn); + execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, contrailServiceInstanceFqdn); + } + else if (key.endsWith("contrail_network_policy_fqdn")) { + String contrailNetworkPolicyFqdn = vfModuleOutputs.get(key); + msoLogger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn); + contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn); + } + else if (key.equals("oam_management_v4_address")) { + String oamManagementV4Address = vfModuleOutputs.get(key); + msoLogger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address); + genericVnf.setIpv4OamAddress(oamManagementV4Address); + execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, oamManagementV4Address); + } + else if (key.equals("oam_management_v6_address")) { + String oamManagementV6Address = vfModuleOutputs.get(key); + msoLogger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address); + genericVnf.setManagementV6Address(oamManagementV6Address); + execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, oamManagementV6Address); + } + + if (!contrailNetworkPolicyFqdnList.isEmpty()) { + execution.setVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST, String.join(",", contrailNetworkPolicyFqdnList)); + } + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java new file mode 100644 index 0000000000..aaa9e51d15 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java @@ -0,0 +1,83 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.audit; + + +import org.onap.so.audit.beans.AuditInventory; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +public class AuditTasks { + + private static final Logger logger = LoggerFactory.getLogger(AuditTasks.class); + + @Autowired + private ExceptionBuilder exceptionUtil; + + @Autowired + private ExtractPojosForBB extractPojosForBB; + + @Autowired + private Environment env; + + public void isAuditNeeded(BuildingBlockExecution execution) { + try { + logger.debug("auditInventoryNeeded Value: {}", env.getProperty("mso.infra.auditInventory")); + execution.setVariable("auditInventoryNeeded",env.getProperty("mso.infra.auditInventory")); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void setupAuditVariable(BuildingBlockExecution execution) { + try { + execution.setVariable("auditInventory",createAuditInventory(execution)); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + private AuditInventory createAuditInventory(BuildingBlockExecution execution) throws BBObjectNotFoundException { + AuditInventory auditInventory = new AuditInventory(); + + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + + auditInventory.setCloudOwner(cloudRegion.getCloudOwner()); + auditInventory.setCloudRegion(cloudRegion.getLcpCloudRegionId()); + auditInventory.setTenantId(cloudRegion.getTenantId()); + auditInventory.setHeatStackName(vfModule.getVfModuleName()); + return auditInventory; + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java new file mode 100644 index 0000000000..f2fb37e182 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.flowspecific.tasks; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.client.exception.ExceptionBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +public class ActivateVfModule { + + private static final Logger logger = LoggerFactory.getLogger(ActivateVfModule.class); + + protected static final String VF_MODULE_TIMER_DURATION_PATH = "mso.workflow.vfModuleActivate.timer.duration"; + protected static final String DEFAULT_TIMER_DURATION = "PT180S"; + + @Autowired + private ExceptionBuilder exceptionUtil; + + @Autowired + private Environment environment; + + + public void setTimerDuration(BuildingBlockExecution execution) { + try { + String waitDuration = this.environment.getProperty(VF_MODULE_TIMER_DURATION_PATH, DEFAULT_TIMER_DURATION); + logger.debug("Sleeping before proceeding with SDNC activate. Timer duration: {}", waitDuration); + execution.setVariable("vfModuleActivateTimerDuration", waitDuration); + } catch (Exception e) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java index 2dae820e95..4f2e2c98d2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java @@ -21,7 +21,10 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks; import java.util.HashMap; import java.util.Optional; - +import java.net.HttpURLConnection; +import java.net.SocketTimeoutException; +import org.apache.http.conn.ConnectTimeoutException; +import org.camunda.bpm.engine.delegate.BpmnError; import org.onap.appc.client.lcm.model.Action; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; @@ -105,10 +108,22 @@ public class GenericVnfHealthCheck { appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); appcCode = appCClient.getErrorCode(); appcMessage = appCClient.getErrorMessage(); - + } catch (BpmnError ex) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Caught exception in GenericVnfHealthCheck", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); + appcMessage = ex.getMessage(); + exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "Caught exception in runAppcCommand in GenericVnfHealthCheck", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "APPC Error", e); - appcMessage = e.getMessage(); + if (e instanceof java.util.concurrent.TimeoutException ) + { + appcMessage = "Request to APPC timed out. "; + msoLogger.error(MessageEnum.RA_CONNECTION_EXCEPTION, "Caught timedOut exception in runAppcCommand in GenericVnfHealthCheck", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "APPC Error", e); + throw e; + } + else { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "Caught exception in runAppcCommand in GenericVnfHealthCheck", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "APPC Error", e); + appcMessage = e.getMessage(); + exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); + } } msoLogger.error("Error Message: " + appcMessage); msoLogger.error("ERROR CODE: " + appcCode); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java index b0063c1da1..2065dfb71e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java @@ -105,6 +105,10 @@ public class OrchestrationStatusValidator { org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID)); orchestrationStatus = configuration.getOrchestrationStatus(); break; + case NO_VALIDATE: + //short circuit and exit method + execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, OrchestrationStatusValidationDirective.VALIDATION_SKIPPED); + return; default: // can't currently get here, so not tested. Added in case enum is expanded without a change to this code throw new OrchestrationStatusValidationException(String.format(UNKNOWN_RESOURCE_TYPE, buildingBlockFlowName, buildingBlockDetail.getResourceType(), buildingBlockDetail.getTargetAction())); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index d18fd006f4..0082545fa1 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -68,6 +68,8 @@ import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; import org.onap.so.serviceinstancebeans.Networks; +import org.onap.so.serviceinstancebeans.RelatedInstance; +import org.onap.so.serviceinstancebeans.RelatedInstanceList; import org.onap.so.serviceinstancebeans.RequestDetails; import org.onap.so.serviceinstancebeans.Service; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; @@ -198,7 +200,7 @@ public class WorkflowAction { if (orchFlows == null || orchFlows.isEmpty()) { orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, cloudOwner, serviceType); } - orchFlows = filterOrchFlows(orchFlows, resourceType, execution); + orchFlows = filterOrchFlows(sIRequest, orchFlows, resourceType, execution); String key = ""; ModelInfo modelInfo = sIRequest.getRequestDetails().getModelInfo(); if(modelInfo.getModelType().equals(ModelType.service)) { @@ -303,8 +305,9 @@ public class WorkflowAction { } } - // If the user set "Homing_Solution" to "none", disable homing, else if "Homing_Solution" is specified, enable it. - if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) { + // If the user set "Homing_Solution" to "none", disable homing, else if "Homing_Solution" is specified, enable it. + if (sIRequest.getRequestDetails().getRequestParameters() != null && + sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) { List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams(); for (Map<String, Object> params : userParams) { if (params.containsKey(HOMINGSOLUTION)) { @@ -320,12 +323,13 @@ public class WorkflowAction { if (flowsToExecute.isEmpty()) { throw new IllegalStateException("Macro did not come up with a valid execution path."); } - + List<String> flowNames = new ArrayList<>(); logger.info("List of BuildingBlocks to execute:"); for (ExecuteBuildingBlock ebb : flowsToExecute) { logger.info(ebb.getBuildingBlock().getBpmnFlowName()); + flowNames.add(ebb.getBuildingBlock().getBpmnFlowName()); } - + execution.setVariable("flowNames", flowNames); execution.setVariable(G_CURRENT_SEQUENCE, 0); execution.setVariable("retryCount", 0); execution.setVariable("isRollback", false); @@ -1101,10 +1105,22 @@ public class WorkflowAction { return listToExecute; } - protected List<OrchestrationFlow> filterOrchFlows(List<OrchestrationFlow> orchFlows, WorkflowType resourceType, DelegateExecution execution) { + protected List<OrchestrationFlow> filterOrchFlows(ServiceInstancesRequest sIRequest, List<OrchestrationFlow> orchFlows, WorkflowType resourceType, DelegateExecution execution) { List<OrchestrationFlow> result = new ArrayList<>(orchFlows); + String vnfCustomizationUUID = ""; + String vfModuleCustomizationUUID = sIRequest.getRequestDetails().getModelInfo().getModelCustomizationUuid(); + RelatedInstanceList[] relatedInstanceList = sIRequest.getRequestDetails().getRelatedInstanceList(); + if (relatedInstanceList != null) { + for (RelatedInstanceList relatedInstList : relatedInstanceList) { + RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { + vnfCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationUuid(); + } + } + } + if (resourceType.equals(WorkflowType.VFMODULE)) { - List<String> fabricCustomizations = traverseCatalogDbForConfiguration((String)execution.getVariable("vnfId"), (String)execution.getVariable("vfModuleId")); + List<String> fabricCustomizations = traverseCatalogDbForConfiguration(vnfCustomizationUUID, vfModuleCustomizationUUID); if (fabricCustomizations.isEmpty()) { result = orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION)).collect(Collectors.toList()); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java index c895566ca5..c8eeaa7a2b 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java @@ -302,4 +302,8 @@ public class AAIObjectMapper { public org.onap.aai.domain.yang.Subnet mapSubnet (Subnet subnet){ return modelMapper.map(subnet,org.onap.aai.domain.yang.Subnet.class); } + + public org.onap.aai.domain.yang.NetworkPolicy mapNetworkPolicy (NetworkPolicy networkPolicy){ + return modelMapper.map(networkPolicy,org.onap.aai.domain.yang.NetworkPolicy.class); + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java index 794314bf8c..f917aed39e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java @@ -22,6 +22,7 @@ package org.onap.so.client.adapter.network.mapper; import java.io.UnsupportedEncodingException; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; @@ -92,14 +93,19 @@ public class NetworkAdapterObjectMapper { networkTechnology = l3Network.getNetworkTechnology(); logger.warn("NetworkTechnology was null in CatalogDB. Using field from AAI: " + networkTechnology); } - createNetworkRequest.setNetworkTechnology(setNetworkTechnology(networkTechnology)); + if (networkTechnology != null) { + createNetworkRequest.setNetworkTechnology(networkTechnology.toUpperCase()); + if (createNetworkRequest.getNetworkTechnology().contains("CONTRAIL")) { + createNetworkRequest.setContrailRequest(true); + } + } //build and set Contrail Network ContrailNetwork contrailNetwork = buildContrailNetwork(l3Network, customer); createNetworkRequest.setContrailNetwork(contrailNetwork); - //set Network Parameters from VID request - createNetworkRequest.setNetworkParams(userInput); + //set Network Parameters from VID request, add "shared" and "external" to this map + createNetworkRequest.setNetworkParams(addSharedAndExternal(userInput, l3Network)); createNetworkRequest = setFlowFlags(createNetworkRequest, orchestrationContext); @@ -112,16 +118,6 @@ public class NetworkAdapterObjectMapper { return createNetworkRequest; } - protected NetworkTechnology setNetworkTechnology(String networkTechnology) { - if(networkTechnology.equalsIgnoreCase("Contrail")) { - return NetworkTechnology.CONTRAIL; - } else if(networkTechnology.equalsIgnoreCase("Neutron")){ - return NetworkTechnology.NEUTRON; - } else { - return NetworkTechnology.VMWARE; - } - } - public DeleteNetworkRequest deleteNetworkRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, ServiceInstance serviceInstance, L3Network l3Network) throws UnsupportedEncodingException { DeleteNetworkRequest deleteNetworkRequest = new DeleteNetworkRequest(); @@ -182,7 +178,7 @@ public class NetworkAdapterObjectMapper { updateNetworkRequest.setSubnets(buildOpenstackSubnetList(l3Network)); updateNetworkRequest.setProviderVlanNetwork(buildProviderVlanNetwork(l3Network)); updateNetworkRequest.setContrailNetwork(buildContrailNetwork(l3Network, customer)); - updateNetworkRequest.setNetworkParams(userInput); + updateNetworkRequest.setNetworkParams(addSharedAndExternal(userInput, l3Network)); updateNetworkRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance)); setFlowFlags(updateNetworkRequest, orchestrationContext); @@ -287,6 +283,14 @@ public class NetworkAdapterObjectMapper { //add host route to the list openstackHostRouteList.add(openstackHostRoute); } + if (subnet.getDhcpStart() != null && !subnet.getDhcpStart().equals("")) { + org.onap.so.openstack.beans.Pool openstackAllocationPool = new org.onap.so.openstack.beans.Pool(); + openstackAllocationPool.setStart(subnet.getDhcpStart()); + openstackAllocationPool.setEnd(subnet.getDhcpEnd()); + List<org.onap.so.openstack.beans.Pool> allocationPools = new ArrayList<>(); + allocationPools.add(openstackAllocationPool); + openstackSubnet.setAllocationPools(allocationPools); + } openstackSubnet.setHostRoutes(openstackHostRouteList); //add subnet to the list subnetList.add(openstackSubnet); @@ -371,4 +375,16 @@ public class NetworkAdapterObjectMapper { updateNetworkRequest.setBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled())); //NetworkTechnology(NetworkTechnology.NEUTRON); NOOP - default } -}
\ No newline at end of file + + private Map<String, String> addSharedAndExternal(Map<String, String> userInput, L3Network l3Network) { + if (userInput == null) + userInput = new HashMap<String, String>(); + if (!userInput.containsKey("shared")) { + userInput.put("shared", Optional.ofNullable(l3Network.isIsSharedNetwork()).orElse(false).toString()); + } + if (!userInput.containsKey("external")) { + userInput.put("external", Optional.ofNullable(l3Network.isIsExternalNetwork()).orElse(false).toString()); + } + return userInput; + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java index 93e588f2e1..701817ab58 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java @@ -29,6 +29,7 @@ import java.util.UUID; import javax.annotation.PostConstruct; +import org.apache.commons.lang3.StringUtils; import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleTopology; @@ -92,7 +93,12 @@ public class VnfAdapterObjectMapper { deleteVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); deleteVolumeGroupRequest.setTenantId(cloudRegion.getTenantId()); deleteVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId()); - deleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId()); + if (!StringUtils.isEmpty(volumeGroup.getHeatStackId())){ + deleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId()); + } else + { + deleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getVolumeGroupName()); + } deleteVolumeGroupRequest.setSkipAAI(true); deleteVolumeGroupRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance)); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java index 3ace03ee0a..352d4ec7d1 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java @@ -23,6 +23,7 @@ package org.onap.so.client.adapter.vnf.mapper; import static java.util.Arrays.asList; import java.io.IOException; +import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -35,6 +36,7 @@ import java.util.Optional; import javax.annotation.PostConstruct; +import org.apache.commons.lang3.StringUtils; import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; import org.onap.sdnc.northbound.client.model.GenericResourceApiSubInterfaceNetworkData; @@ -443,7 +445,6 @@ public class VnfAdapterVfModuleObjectMapper { } } } - } private void buildVfModuleNetworkInformation(Map<String,String> paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) { @@ -780,16 +781,26 @@ public class VnfAdapterVfModuleObjectMapper { deleteVfModuleRequest.setTenantId(cloudRegion.getTenantId()); deleteVfModuleRequest.setVnfId(genericVnf.getVnfId()); deleteVfModuleRequest.setVfModuleId(vfModule.getVfModuleId()); - deleteVfModuleRequest.setVfModuleStackId(vfModule.getHeatStackId());//DoDVfMod_heatStackId - deleteVfModuleRequest.setSkipAAI(true); - String messageId = vnfAdapterObjectMapperUtils.getRandomUuid(); - deleteVfModuleRequest.setMessageId(messageId); - deleteVfModuleRequest.setNotificationUrl(vnfAdapterObjectMapperUtils.createCallbackUrl("VNFAResponse", messageId)); + if (!StringUtils.isEmpty(vfModule.getHeatStackId())){ + deleteVfModuleRequest.setVfModuleStackId(vfModule.getHeatStackId());//DoDVfMod_heatStackId + } else + { + deleteVfModuleRequest.setVfModuleStackId(vfModule.getVfModuleName()); + } + + deleteVfModuleRequest.setSkipAAI(true); + setIdAndUrl(deleteVfModuleRequest); MsoRequest msoRequest = buildMsoRequest(requestContext, serviceInstance); deleteVfModuleRequest.setMsoRequest(msoRequest); return deleteVfModuleRequest; } + protected void setIdAndUrl(DeleteVfModuleRequest deleteVfModuleRequest) throws UnsupportedEncodingException{ + String messageId = vnfAdapterObjectMapperUtils.getRandomUuid(); + deleteVfModuleRequest.setMessageId(messageId); + deleteVfModuleRequest.setNotificationUrl(vnfAdapterObjectMapperUtils.createCallbackUrl("VNFAResponse", messageId)); + } + private String convertToString(Object obj) { String json; try { @@ -814,4 +825,4 @@ public class VnfAdapterVfModuleObjectMapper { } return baseVfModule; } -} +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java index d2bf95a28e..4ca3f2a78d 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java @@ -45,6 +45,7 @@ import org.springframework.stereotype.Component; @Component public class AAINetworkResources { + @Autowired private InjectionHelper injectionHelper; @@ -171,6 +172,16 @@ public class AAINetworkResources { AAIResourceUri instanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); injectionHelper.getAaiClient().delete(instanceGroupURI); } - - + + public void createNetworkPolicy(org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy networkPolicy) { + NetworkPolicy aaiNetworkPolicy = aaiObjectMapper.mapNetworkPolicy(networkPolicy); + String networkPolicyId = networkPolicy.getNetworkPolicyId(); + AAIResourceUri netUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId); + injectionHelper.getAaiClient().create(netUri, aaiNetworkPolicy); + } + + public void deleteNetworkPolicy(String networkPolicyId) { + AAIResourceUri networkPolicyURI = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId); + injectionHelper.getAaiClient().delete(networkPolicyURI); + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java index a641d43ba3..ef61319eee 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java @@ -76,6 +76,15 @@ public class AAIVfModuleResources { injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule); } + public void updateContrailServiceInstanceFqdnVfModule(VfModule vfModule, GenericVnf vnf) { + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); + VfModule copiedVfModule = vfModule.shallowCopyId(); + + copiedVfModule.setContrailServiceInstanceFqdn(vfModule.getContrailServiceInstanceFqdn()); + org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(copiedVfModule); + injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule); + } + public void changeAssignVfModule(VfModule vfModule, GenericVnf vnf) { AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); org.onap.aai.domain.yang.VfModule AAIVfModule = aaiObjectMapper.mapVfModule(vfModule); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java index b42636b078..1f8c56e727 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java @@ -29,28 +29,28 @@ public class Candidate implements Serializable{ private static final long serialVersionUID = -5474502255533410907L; - @JsonProperty("candidateType") - private CandidateType candidateType; - @JsonProperty("candidates") - private List<String> candidates; + @JsonProperty("identifierType") + private CandidateType identifierType; + @JsonProperty("identifiers") + private List<String> identifiers; @JsonProperty("cloudOwner") private String cloudOwner; - public CandidateType getCandidateType(){ - return candidateType; + public CandidateType getIdentifierType(){ + return identifierType; } - public void setCandidateType(CandidateType candidateType){ - this.candidateType = candidateType; + public void setIdentifierType(CandidateType identifierType){ + this.identifierType = identifierType; } - public List<String> getCandidates(){ - return candidates; + public List<String> getIdentifiers(){ + return identifiers; } - public void setCandidates(List<String> candidates){ - this.candidates = candidates; + public void setIdentifiers(List<String> identifiers){ + this.identifiers = identifiers; } public String getCloudOwner(){ diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java index 873ff7ca95..cf28c114e8 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.common.aai.tasks; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java index df1f0adcea..d8c7ebaff7 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java @@ -45,6 +45,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; @@ -516,7 +517,7 @@ public class TestDataSetup{ VfModule vfModule = new VfModule(); vfModule.setVfModuleId("testVfModuleId" + vfModuleCounter); vfModule.setVfModuleName("testVfModuleName" + vfModuleCounter); - + vfModule.setModuleIndex(0); ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); modelInfoVfModule.setModelInvariantUUID("testModelInvariantUUID" + vfModuleCounter); modelInfoVfModule.setModelVersion("testModelVersion" + vfModuleCounter); @@ -529,6 +530,10 @@ public class TestDataSetup{ } public VfModule setVfModule() { + return setVfModule(true); + } + + public VfModule setVfModule(boolean addToGenericVnf) { VfModule vfModule = buildVfModule(); GenericVnf genericVnf = null; @@ -539,7 +544,9 @@ public class TestDataSetup{ genericVnf = setGenericVnf(); } - genericVnf.getVfModules().add(vfModule); + if (addToGenericVnf) { + genericVnf.getVfModules().add(vfModule); + } lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId()); return vfModule; @@ -702,4 +709,12 @@ public class TestDataSetup{ subnet.setNeutronSubnetId("testNeutronSubnetId"); return subnet; } + + public NetworkPolicy buildNetworkPolicy() { + NetworkPolicy networkPolicy = new NetworkPolicy(); + networkPolicy.setNetworkPolicyId("testNetworkPolicyId"); + networkPolicy.setNetworkPolicyFqdn("testNetworkPolicyFqdn"); + networkPolicy.setHeatStackId("testHeatStackId"); + return networkPolicy; + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java index da7e727488..c48019af83 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java @@ -19,6 +19,7 @@ */ package org.onap.so.bpmn.infrastructure.aai.tasks; +import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doNothing; @@ -29,12 +30,18 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import java.util.Arrays; +import java.util.Optional; +import java.util.TreeSet; + import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import org.mockito.ArgumentCaptor; import org.mockito.ArgumentMatchers; +import org.mockito.Captor; import org.mockito.InjectMocks; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; @@ -43,12 +50,16 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; public class AAICreateTasksTest extends BaseTaskTest{ @@ -65,6 +76,9 @@ public class AAICreateTasksTest extends BaseTaskTest{ private Customer customer; private Configuration configuration; + @Captor + ArgumentCaptor<NetworkPolicy> networkPolicyCaptor; + @Rule public final ExpectedException exception = ExpectedException.none(); @@ -268,9 +282,17 @@ public class AAICreateTasksTest extends BaseTaskTest{ @Test public void createVfModuleTest() throws Exception { - doNothing().when(aaiVfModuleResources).createVfModule(vfModule, genericVnf); + + VfModule newVfModule = setVfModule(false); + newVfModule.setModuleIndex(null); + newVfModule.getModelInfoVfModule().setModelInvariantUUID("testModelInvariantUUID1"); + doNothing().when(aaiVfModuleResources).createVfModule(newVfModule, genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(newVfModule); + + assertEquals(null, newVfModule.getModuleIndex()); aaiCreateTasks.createVfModule(execution); - verify(aaiVfModuleResources, times(1)).createVfModule(vfModule, genericVnf); + assertEquals(1, newVfModule.getModuleIndex().intValue()); + verify(aaiVfModuleResources, times(1)).createVfModule(newVfModule, genericVnf); } @Test @@ -445,4 +467,138 @@ public class AAICreateTasksTest extends BaseTaskTest{ aaiCreateTasks.connectVnfToTenant(execution); verify(aaiVnfResources, times(1)).connectVnfToTenant(genericVnf, gBBInput.getCloudRegion()); } + @Test + public void createNetworkPolicyNeedToCreateAllTest() throws Exception { + execution.setVariable("heatStackId", "testHeatStackId"); + execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123,ED456"); + Optional<NetworkPolicy> networkPolicy = Optional.empty(); + doReturn(networkPolicy).when(aaiNetworkResources).getNetworkPolicy(any(AAIResourceUri.class)); + doNothing().when(aaiNetworkResources).createNetworkPolicy(any(NetworkPolicy.class)); + aaiCreateTasks.createNetworkPolicies(execution); + verify(aaiNetworkResources, times(2)).createNetworkPolicy(networkPolicyCaptor.capture()); + assertEquals("ABC123", networkPolicyCaptor.getAllValues().get(0).getNetworkPolicyFqdn()); + assertEquals("ED456", networkPolicyCaptor.getAllValues().get(1).getNetworkPolicyFqdn()); + assertEquals("testHeatStackId", networkPolicyCaptor.getAllValues().get(0).getHeatStackId()); + assertEquals("testHeatStackId", networkPolicyCaptor.getAllValues().get(1).getHeatStackId()); + } + + @Test + public void createNetworkPolicyNeedToCreateNoneTest() throws Exception { + execution.setVariable("heatStackId", "testHeatStackId"); + execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123"); + NetworkPolicy networkPolicy = new NetworkPolicy(); + doReturn(Optional.of(networkPolicy)).when(aaiNetworkResources).getNetworkPolicy(any(AAIResourceUri.class)); + doNothing().when(aaiNetworkResources).createNetworkPolicy(any(NetworkPolicy.class)); + aaiCreateTasks.createNetworkPolicies(execution); + verify(aaiNetworkResources, times(0)).createNetworkPolicy(any(NetworkPolicy.class)); + } + + @Test + public void createNetworkPolicyNoNetworkPoliciesTest() throws Exception { + execution.setVariable("heatStackId", "testHeatStackId"); + aaiCreateTasks.createNetworkPolicies(execution); + verify(aaiNetworkResources, times(0)).createNetworkPolicy(any(NetworkPolicy.class)); + } + + @Test + public void createVfModuleGetLowestIndexTest() throws Exception { + GenericVnf vnf = new GenericVnf(); + ModelInfoGenericVnf vnfInfo = new ModelInfoGenericVnf(); + vnf.setModelInfoGenericVnf(vnfInfo); + vnfInfo.setModelInvariantUuid("my-uuid"); + + ModelInfoVfModule infoA = new ModelInfoVfModule(); + infoA.setIsBaseBoolean(false); + infoA.setModelInvariantUUID("A"); + + ModelInfoVfModule infoB = new ModelInfoVfModule(); + infoB.setIsBaseBoolean(false); + infoB.setModelInvariantUUID("B"); + + ModelInfoVfModule infoC = new ModelInfoVfModule(); + infoC.setIsBaseBoolean(false); + infoC.setModelInvariantUUID("C"); + + VfModule newVfModuleA = new VfModule(); + newVfModuleA.setVfModuleId("a"); + VfModule newVfModuleB = new VfModule(); + newVfModuleB.setVfModuleId("b"); + VfModule newVfModuleC = new VfModule(); + newVfModuleC.setVfModuleId("c"); + + VfModule vfModule = new VfModule(); + vnf.getVfModules().add(vfModule); + vfModule.setVfModuleId("1"); + + VfModule vfModule2 = new VfModule(); + vnf.getVfModules().add(vfModule2); + vfModule2.setVfModuleId("2"); + + VfModule vfModule3 = new VfModule(); + vnf.getVfModules().add(vfModule3); + vfModule3.setVfModuleId("3"); + + VfModule vfModule4 = new VfModule(); + vnf.getVfModules().add(vfModule4); + vfModule4.setVfModuleId("4"); + + VfModule vfModule5 = new VfModule(); + vnf.getVfModules().add(vfModule5); + vfModule5.setVfModuleId("5"); + + //modules are included in the vnf already + vnf.getVfModules().add(newVfModuleA); + vnf.getVfModules().add(newVfModuleB); + vnf.getVfModules().add(newVfModuleC); + + //A + newVfModuleA.setModelInfoVfModule(infoA); + vfModule.setModelInfoVfModule(infoA); + vfModule2.setModelInfoVfModule(infoA); + vfModule3.setModelInfoVfModule(infoA); + + //B + + newVfModuleB.setModelInfoVfModule(infoB); + vfModule4.setModelInfoVfModule(infoB); + vfModule5.setModelInfoVfModule(infoB); + + //C + newVfModuleC.setModelInfoVfModule(infoC); + + + //A + vfModule.setModuleIndex(2); + vfModule2.setModuleIndex(0); + vfModule3.setModuleIndex(3); + + //B + vfModule4.setModuleIndex(null); + vfModule5.setModuleIndex(1); + + assertEquals(1, aaiCreateTasks.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, newVfModuleA)); + + assertEquals(2, aaiCreateTasks.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, newVfModuleB)); + + assertEquals(0, aaiCreateTasks.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, newVfModuleC)); + + } + + @Test + public void calculateUnusedIndexTest() { + + TreeSet<Integer> a = new TreeSet<>(Arrays.asList(0,1,3)); + TreeSet<Integer> b = new TreeSet<>(Arrays.asList(0,1,8)); + TreeSet<Integer> c = new TreeSet<>(Arrays.asList(0,2,4)); + assertEquals(2, aaiCreateTasks.calculateUnusedIndex(a, 0)); + assertEquals(5, aaiCreateTasks.calculateUnusedIndex(a, 2)); + + assertEquals(4, aaiCreateTasks.calculateUnusedIndex(b, 2)); + assertEquals(3, aaiCreateTasks.calculateUnusedIndex(b, 1)); + + assertEquals(5, aaiCreateTasks.calculateUnusedIndex(c, 2)); + assertEquals(9, aaiCreateTasks.calculateUnusedIndex(c, 6)); + assertEquals(1, aaiCreateTasks.calculateUnusedIndex(c, 0)); + + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java index 67f5d197de..5cb775180e 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java @@ -20,22 +20,26 @@ package org.onap.so.bpmn.infrastructure.aai.tasks; +import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import java.util.ArrayList; -import java.util.List; +import java.util.Optional; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Test; +import org.mockito.ArgumentCaptor; import org.mockito.ArgumentMatchers; +import org.mockito.Captor; import org.mockito.InjectMocks; +import org.onap.aai.domain.yang.NetworkPolicy; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @@ -46,6 +50,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.exception.BBObjectNotFoundException; @@ -62,6 +67,9 @@ public class AAIDeleteTasksTest extends BaseTaskTest { private CloudRegion cloudRegion; private Configuration configuration; + @Captor + ArgumentCaptor<String> stringCaptor; + @Before public void before() throws BBObjectNotFoundException { serviceInstance = setServiceInstance(); @@ -179,4 +187,34 @@ public class AAIDeleteTasksTest extends BaseTaskTest { aaiDeleteTasks.deleteConfiguration(execution); verify(aaiConfigurationResources, times(1)).deleteConfiguration(configuration); } + + @Test + public void deleteNetworkPolicyNeedToDeleteAllTest() throws Exception { + execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123,DEF456"); + NetworkPolicy networkPolicy0 = new NetworkPolicy(); + networkPolicy0.setNetworkPolicyId("testNetworkPolicyId0"); + NetworkPolicy networkPolicy1 = new NetworkPolicy(); + networkPolicy1.setNetworkPolicyId("testNetworkPolicyId1"); + doReturn(Optional.of(networkPolicy0),Optional.of(networkPolicy1)).when(aaiNetworkResources).getNetworkPolicy(any(AAIResourceUri.class)); + doNothing().when(aaiNetworkResources).deleteNetworkPolicy(any(String.class)); + aaiDeleteTasks.deleteNetworkPolicies(execution); + verify(aaiNetworkResources, times(2)).deleteNetworkPolicy(stringCaptor.capture()); + assertEquals("testNetworkPolicyId0", stringCaptor.getAllValues().get(0)); + assertEquals("testNetworkPolicyId1", stringCaptor.getAllValues().get(1)); + } + + @Test + public void deleteNetworkPolicyNeedToDeleteNoneTest() throws Exception { + execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123"); + Optional<NetworkPolicy> networkPolicy = Optional.empty(); + doReturn(networkPolicy).when(aaiNetworkResources).getNetworkPolicy(any(AAIResourceUri.class)); + aaiDeleteTasks.deleteNetworkPolicies(execution); + verify(aaiNetworkResources, times(0)).deleteNetworkPolicy(any(String.class)); + } + + @Test + public void deleteNetworkPolicyNoNetworkPoliciesTest() throws Exception { + aaiDeleteTasks.deleteNetworkPolicies(execution); + verify(aaiNetworkResources, times(0)).deleteNetworkPolicy(any(String.class)); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java index f97b137fb3..73d7257632 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java @@ -586,4 +586,49 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ verify(aaiConfigurationResources, times(1)).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE); } + @Test + public void updateContrailServiceInstanceFqdnVfModuleTest() throws Exception { + execution.setVariable("contrailServiceInstanceFqdn", "newContrailServiceInstanceFqdn"); + doNothing().when(aaiVfModuleResources).updateContrailServiceInstanceFqdnVfModule(vfModule, genericVnf); + + aaiUpdateTasks.updateContrailServiceInstanceFqdnVfModule(execution); + + verify(aaiVfModuleResources, times(1)).updateContrailServiceInstanceFqdnVfModule(vfModule, genericVnf); + assertEquals("newContrailServiceInstanceFqdn", vfModule.getContrailServiceInstanceFqdn()); + } + @Test + public void updateContrailServiceInstanceFqdnVfModuleNoUpdateTest() throws Exception { + aaiUpdateTasks.updateContrailServiceInstanceFqdnVfModule(execution); + verify(aaiVfModuleResources, times(0)).updateContrailServiceInstanceFqdnVfModule(vfModule, genericVnf); + } + @Test + public void updateIpv4OamAddressVnfTest() throws Exception { + execution.setVariable("oamManagementV4Address", "newIpv4OamAddress"); + doNothing().when(aaiVnfResources).updateObjectVnf(genericVnf); + + aaiUpdateTasks.updateIpv4OamAddressVnf(execution); + + verify(aaiVnfResources, times(1)).updateObjectVnf(genericVnf); + assertEquals("newIpv4OamAddress", genericVnf.getIpv4OamAddress()); + } + @Test + public void updateIpv4OamAddressVnfNoUpdateTest() throws Exception { + aaiUpdateTasks.updateIpv4OamAddressVnf(execution); + verify(aaiVnfResources, times(0)).updateObjectVnf(genericVnf); + } + @Test + public void updateManagementV6AddressVnfTest() throws Exception { + execution.setVariable("oamManagementV6Address", "newManagementV6Address"); + doNothing().when(aaiVnfResources).updateObjectVnf(genericVnf); + + aaiUpdateTasks.updateManagementV6AddressVnf(execution); + + verify(aaiVnfResources, times(1)).updateObjectVnf(genericVnf); + assertEquals("newManagementV6Address", genericVnf.getManagementV6Address()); + } + @Test + public void updateManagementV6AddressVnfNoUpdateTest() throws Exception { + aaiUpdateTasks.updateManagementV6AddressVnf(execution); + verify(aaiVnfResources, times(0)).updateObjectVnf(genericVnf); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java index 2ba8cb4b57..516c9480ad 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java @@ -1,11 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.adapter.network.tasks; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertThat; + import java.io.IOException; +import java.util.HashMap; +import java.util.Map; import javax.xml.bind.JAXBException; import org.junit.Test; import org.onap.so.adapters.nwrest.CreateNetworkResponse; +import org.onap.so.adapters.nwrest.UpdateNetworkResponse; public class NetworkAdapterRestV1Test { @@ -16,4 +42,17 @@ public class NetworkAdapterRestV1Test { String returnedXml = response.toXmlString(); System.out.println(returnedXml); } + + @Test + public void testUnmarshalXmlUpdate() throws IOException, JAXBException { + UpdateNetworkResponse expectedResponse = new UpdateNetworkResponse(); + expectedResponse.setMessageId("ec100bcc-2659-4aa4-b4d8-3255715c2a51"); + expectedResponse.setNetworkId("80de31e3-cc78-4111-a9d3-5b92bf0a39eb"); + Map<String,String>subnetMap = new HashMap<String,String>(); + subnetMap.put("95cd8437-25f1-4238-8720-cbfe7fa81476", "d8d16606-5d01-4822-b160-9a0d257303e0"); + expectedResponse.setSubnetMap(subnetMap); + String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><updateNetworkResponse><messageId>ec100bcc-2659-4aa4-b4d8-3255715c2a51</messageId><networkId>80de31e3-cc78-4111-a9d3-5b92bf0a39eb</networkId><subnetMap><entry><key>95cd8437-25f1-4238-8720-cbfe7fa81476</key><value>d8d16606-5d01-4822-b160-9a0d257303e0</value></entry></subnetMap></updateNetworkResponse>"; + UpdateNetworkResponse response = (UpdateNetworkResponse) new NetworkAdapterRestV1().unmarshalXml(xml, UpdateNetworkResponse.class); + assertThat(expectedResponse, sameBeanAs(response)); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java index 4158f9cfae..33d0dbe130 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.adapter.vnf.tasks; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; @@ -35,6 +36,7 @@ import org.mockito.InjectMocks; import org.onap.so.FileUtil; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; @@ -50,6 +52,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { private RequestContext requestContext; private ServiceInstance serviceInstance; + private GenericVnf genericVnf; private VfModule vfModule; private VolumeGroup volumeGroup; @@ -58,12 +61,17 @@ public class VnfAdapterImplTest extends BaseTaskTest { private static final String VNF_ADAPTER_VOLUME_CREATE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml"); private static final String VNF_ADAPTER_VOLUME_DELETE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/DeleteVfModuleVolumeCallbackResponse.xml"); private static final String TEST_VFMODULE_HEATSTACK_ID = "slowburn"; - private static final String TEST_VOLUME_HEATSTACK_ID = "testHeatStackId1"; + private static final String TEST_VOLUME_HEATSTACK_ID = "testHeatStackId1"; + private static final String TEST_CONTRAIL_SERVICE_INSTANCE_FQDN = "default-domain:MSOTest:MsoNW-RA"; + private static final String TEST_OAM_MANAGEMENT_V4_ADDRESS = "127.0.0.1"; + private static final String TEST_OAM_MANAGEMENT_V6_ADDRESS = "2000:abc:bce:1111"; + private static final String TEST_CONTRAIL_NETWORK_POLICY_FQDNS = "MSOTest:DefaultPolicyFQDN2,MSOTest:DefaultPolicyFQDN1"; @Before public void before() throws BBObjectNotFoundException { requestContext = setRequestContext(); serviceInstance = setServiceInstance(); + genericVnf = setGenericVnf(); vfModule = setVfModule(); volumeGroup = setVolumeGroup(); vfModule.setHeatStackId(null); @@ -72,6 +80,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance); when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule); } @@ -86,8 +95,15 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_CreateResponseTest() { execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE); - vnfAdapterImpl.postProcessVnfAdapter(execution); + vnfAdapterImpl.postProcessVnfAdapter(execution); assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId()); + assertEquals(TEST_CONTRAIL_SERVICE_INSTANCE_FQDN, vfModule.getContrailServiceInstanceFqdn()); + assertEquals(TEST_CONTRAIL_SERVICE_INSTANCE_FQDN, execution.getVariable("contrailServiceInstanceFqdn")); + assertEquals(TEST_OAM_MANAGEMENT_V4_ADDRESS, genericVnf.getIpv4OamAddress()); + assertEquals(TEST_OAM_MANAGEMENT_V4_ADDRESS, execution.getVariable("oamManagementV4Address")); + assertEquals(TEST_OAM_MANAGEMENT_V6_ADDRESS, genericVnf.getManagementV6Address()); + assertEquals(TEST_OAM_MANAGEMENT_V6_ADDRESS, execution.getVariable("oamManagementV6Address")); + assertEquals(TEST_CONTRAIL_NETWORK_POLICY_FQDNS, execution.getVariable("contrailNetworkPolicyFqdnList")); } @@ -111,6 +127,20 @@ public class VnfAdapterImplTest extends BaseTaskTest { vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(vfModule.getHeatStackId()); } + + @Test + public void postProcessVnfAdapter_CreateResponseTest_EmptyVfModuleOutputs() { + execution.setVariable("vnfAdapterRestV1Response", "<createVfModuleResponse><vfModuleOutputs></vfModuleOutputs></createVfModuleResponse>"); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertNull(vfModule.getHeatStackId()); + assertNull(vfModule.getContrailServiceInstanceFqdn()); + assertNull(execution.getVariable("contrailServiceInstanceFqdn")); + assertNotEquals(TEST_OAM_MANAGEMENT_V4_ADDRESS, genericVnf.getIpv4OamAddress()); + assertNull(execution.getVariable("oamManagementV4Address")); + assertNull(genericVnf.getManagementV6Address()); + assertNull(execution.getVariable("oamManagementV6Address")); + assertNull(execution.getVariable("contrailNetworkPolicyFqdnList")); + } @Test public void postProcessVnfAdapter_DeleteResponseTest() { @@ -118,6 +148,25 @@ public class VnfAdapterImplTest extends BaseTaskTest { execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_DELETE_RESPONSE); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(vfModule.getHeatStackId()); + assertEquals(vfModule.getContrailServiceInstanceFqdn(), ""); + assertEquals(execution.getVariable("contrailServiceInstanceFqdn"), ""); + assertEquals(genericVnf.getIpv4OamAddress(), ""); + assertEquals(execution.getVariable("oamManagementV4Address"), ""); + assertEquals(genericVnf.getManagementV6Address(), ""); + assertEquals(execution.getVariable("oamManagementV6Address"), ""); + assertEquals(TEST_CONTRAIL_NETWORK_POLICY_FQDNS, execution.getVariable("contrailNetworkPolicyFqdnList")); + } + + @Test + public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleOutputs() { + execution.setVariable("vnfAdapterRestV1Response", "<createVfModuleResponse><vfModuleOutputs></vfModuleOutputs></createVfModuleResponse>"); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertNull(vfModule.getHeatStackId()); + assertNull(vfModule.getContrailServiceInstanceFqdn()); + assertNull(execution.getVariable("contrailServiceInstanceFqdn")); + assertNull(execution.getVariable("oamManagementV4Address")); + assertNull(execution.getVariable("oamManagementV6Address")); + assertNull(execution.getVariable("contrailNetworkPolicyFqdnList")); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java new file mode 100644 index 0000000000..7a9e2bb6cf --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java @@ -0,0 +1,74 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.audit; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.mockito.ArgumentMatchers; +import org.mockito.InjectMocks; +import org.onap.so.audit.beans.AuditInventory; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.client.exception.BBObjectNotFoundException; + +public class AuditTasksTest extends BaseTaskTest{ + + @InjectMocks + private AuditTasks auditTasks = new AuditTasks(); + private ServiceInstance serviceInstance; + private GenericVnf genericVnf; + private VfModule vfModule; + + + @Rule + public final ExpectedException exception = ExpectedException.none(); + + @Before + public void before() throws BBObjectNotFoundException { + serviceInstance = setServiceInstance(); + genericVnf = setGenericVnf(); + vfModule = setVfModule(); + setCloudRegion(); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance); + } + + @Test + public void setupAuditVariableTest() throws Exception { + AuditInventory expectedAuditInventory = new AuditInventory(); + expectedAuditInventory.setCloudOwner("testCloudOwner"); + expectedAuditInventory.setCloudRegion("testLcpCloudRegionId"); + expectedAuditInventory.setHeatStackName("testVfModuleName1"); + expectedAuditInventory.setTenantId("testTenantId"); + auditTasks.setupAuditVariable(execution); + assertThat((AuditInventory)execution.getVariable("auditInventory"), sameBeanAs(expectedAuditInventory)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModuleTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModuleTest.java new file mode 100644 index 0000000000..d1d167e561 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModuleTest.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.flowspecific.tasks; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.onap.so.bpmn.BaseTaskTest; + +public class ActivateVfModuleTest extends BaseTaskTest { + + @InjectMocks + private ActivateVfModule activateVfModule = new ActivateVfModule(); + + @Test + public void setWaitBeforeDurationTest() throws Exception { + when(env.getProperty(ActivateVfModule.VF_MODULE_TIMER_DURATION_PATH, ActivateVfModule.DEFAULT_TIMER_DURATION)).thenReturn("PT300S"); + activateVfModule.setTimerDuration(execution); + verify(env, times(1)).getProperty(ActivateVfModule.VF_MODULE_TIMER_DURATION_PATH, ActivateVfModule.DEFAULT_TIMER_DURATION); + assertEquals("PT300S", (String) execution.getVariable("vfModuleActivateTimerDuration")); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java index e17859969d..7fdf2535bf 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java @@ -35,6 +35,7 @@ import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; @@ -142,4 +143,34 @@ public class GenericVnfHealthCheckTest extends BaseTaskTest { genericVnfHealthCheck.callAppcClient(execution); verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType); } + + @Test + @Ignore //The runAppCCommand method in not capable of throwing this exception + public void callAppcClientTimeOutExceptionTest() { + expectedException.expect(java.util.concurrent.TimeoutException.class); + Action action = Action.HealthCheck; + String vnfId = genericVnf.getVnfId(); + String payload = "{\"testName\":\"testValue\",}"; + String controllerType = "testType"; + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + payloadInfo.put("vnfName", "testVnfName"); + payloadInfo.put("vfModuleId", "testVfModuleId"); + payloadInfo.put("oamIpAddress", "testOamIpAddress"); + payloadInfo.put("vnfHostIpAddress", "testOamIpAddress"); + execution.setVariable("action", Action.HealthCheck.toString()); + execution.setVariable("msoRequestId", msoRequestId); + execution.setVariable("controllerType", controllerType); + execution.setVariable("vnfId", "testVnfId1"); + execution.setVariable("vnfName", "testVnfName"); + execution.setVariable("vfModuleId", "testVfModuleId"); + execution.setVariable("oamIpAddress", "testOamIpAddress"); + execution.setVariable("vnfHostIpAddress", "testOamIpAddress"); + execution.setVariable("payload", payload); + + doThrow(java.util.concurrent.TimeoutException.class).when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType); + + + genericVnfHealthCheck.callAppcClient(execution); + verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java index f0bb6a369c..59fad5cdd6 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java @@ -84,7 +84,7 @@ public class SniroHomingV2IT extends BaseIntegrationTest{ requestContext.setMsoRequestId("testRequestId"); RequestParameters params = new RequestParameters(); params.setaLaCarte(false); - params.setSubscriptionServiceType("iptollfree"); + params.setSubscriptionServiceType("testSubscriptionServiceType"); requestContext.setRequestParameters(params); } @@ -94,10 +94,10 @@ public class SniroHomingV2IT extends BaseIntegrationTest{ bondingLink.getServiceProxies().add(setServiceProxy("1", "transport")); ServiceProxy sp2 = setServiceProxy("2", "infrastructure"); Candidate requiredCandidate = new Candidate(); - requiredCandidate.setCandidateType(CandidateType.VNF_ID); + requiredCandidate.setIdentifierType(CandidateType.VNF_ID); List<String> c = new ArrayList<String>(); c.add("testVnfId"); - requiredCandidate.setCandidates(c); + requiredCandidate.setIdentifiers(c); sp2.addRequiredCandidates(requiredCandidate); bondingLink.getServiceProxies().add(sp2); serviceInstance.getVpnBondingLinks().add(bondingLink); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java index 1da8a183a6..688f95c3c0 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java @@ -22,7 +22,7 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasksTest.java index a8d7eb3d2e..3cf003d1ad 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasksTest.java @@ -21,7 +21,7 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorUnitTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorUnitTest.java new file mode 100644 index 0000000000..03b39f57e5 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorUnitTest.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.workflow.tasks; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.when; + +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.db.catalog.beans.BuildingBlockDetail; +import org.onap.so.db.catalog.beans.OrchestrationAction; +import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective; +import org.onap.so.db.catalog.beans.ResourceType; +import org.onap.so.db.catalog.client.CatalogDbClient; + +@RunWith(MockitoJUnitRunner.class) +public class OrchestrationStatusValidatorUnitTest { + + @Mock + private CatalogDbClient catalogDbClient; + + @InjectMocks + private OrchestrationStatusValidator validator; + @Test + public void skipValidationTest() { + BuildingBlockDetail bbDetail = new BuildingBlockDetail(); + bbDetail.setBuildingBlockName("customBB"); + bbDetail.setResourceType(ResourceType.NO_VALIDATE); + bbDetail.setTargetAction(OrchestrationAction.CUSTOM); + when(catalogDbClient.getBuildingBlockDetail("customBB")).thenReturn(bbDetail); + BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake()); + execution.setVariable("flowToBeCalled", "customBB"); + execution.setVariable("aLaCarte", false); + validator.validateOrchestrationStatus(execution); + + + assertThat(execution.getVariable("orchestrationStatusValidationResult"), equalTo(OrchestrationStatusValidationDirective.VALIDATION_SKIPPED)); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java index 7b348c8cb3..24b87277c4 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -37,9 +37,11 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashSet; import java.util.List; import java.util.Optional; import java.util.UUID; +import java.util.Set; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -70,6 +72,8 @@ import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResource; import org.onap.so.db.catalog.beans.CollectionResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.ConfigurationResource; +import org.onap.so.db.catalog.beans.CvnfcCustomization; import org.onap.so.db.catalog.beans.HeatEnvironment; import org.onap.so.db.catalog.beans.HeatTemplate; import org.onap.so.db.catalog.beans.InstanceGroup; @@ -77,6 +81,7 @@ import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.beans.NetworkResourceCustomization; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import org.onap.so.serviceinstancebeans.RequestDetails; @@ -854,6 +859,63 @@ public class WorkflowActionTest extends BaseTaskTest { ,"DeleteNetworkCollectionBB"); } + @Test + public void selectExecutionListALaCarteVfModuleNoFabricCreateTest() throws Exception{ + String gAction = "createInstance"; + String resource = "VfModule"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", true); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules"); + + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List<OrchestrationFlow> orchFlows = createFlowList("AssignVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB"); + northBoundRequest.setOrchestrationFlowList(orchFlows); + + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,true,"my-custom-cloud-owner")).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEqualsBulkFlowName(ebbs,"AssignVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB"); + } + + @Test + public void selectExecutionListALaCarteVfModuleFabricCreateTest() throws Exception{ + String gAction = "createInstance"; + String resource = "VfModule"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", true); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List<OrchestrationFlow> orchFlows = createFlowList("AssignVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB"); + northBoundRequest.setOrchestrationFlowList(orchFlows); + + List<CvnfcCustomization> cvnfcCustomizations = new ArrayList<CvnfcCustomization>(); + CvnfcCustomization cvnfcCustomization = new CvnfcCustomization(); + VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization(); + ConfigurationResource configurationResource = new ConfigurationResource(); + configurationResource.setToscaNodeType("FabricConfiguration"); + vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource); + Set<VnfVfmoduleCvnfcConfigurationCustomization> custSet = new HashSet<VnfVfmoduleCvnfcConfigurationCustomization>(); + custSet.add(vnfVfmoduleCvnfcConfigurationCustomization); + cvnfcCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(custSet); + cvnfcCustomizations.add(cvnfcCustomization); + + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,true,"my-custom-cloud-owner")).thenReturn(northBoundRequest); + when(catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID("fc25201d-36d6-43a3-8d39-fdae88e526ae", "9a6d01fd-19a7-490a-9800-460830a12e0b")).thenReturn(cvnfcCustomizations); + workflowAction.selectExecutionList(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEqualsBulkFlowName(ebbs,"AssignVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB"); + } + /** * WorkflowActionBB Tests */ diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java index 297d75a104..2dd4033aa2 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java @@ -57,6 +57,10 @@ import org.onap.so.db.catalog.beans.CvnfcCustomization; import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.serviceinstancebeans.ModelInfo; +import org.onap.so.serviceinstancebeans.RelatedInstance; +import org.onap.so.serviceinstancebeans.RequestDetails; +import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; @RunWith(MockitoJUnitRunner.class) public class WorkflowActionUnitTest { @@ -87,9 +91,16 @@ public class WorkflowActionUnitTest { "flow y", "ActivateFabricConfigurationBB", "flow z"); - doReturn(Arrays.asList("yes", "yes")).when(workflowAction).traverseCatalogDbForConfiguration(ArgumentMatchers.isNull(), ArgumentMatchers.isNull()); + doReturn(Arrays.asList("yes", "yes")).when(workflowAction).traverseCatalogDbForConfiguration(ArgumentMatchers.any(String.class), ArgumentMatchers.isNull()); - List<OrchestrationFlow> result = workflowAction.filterOrchFlows(flows, WorkflowType.VFMODULE, mock(DelegateExecution.class)); + ServiceInstancesRequest sIRequest = new ServiceInstancesRequest(); + RequestDetails requestDetails = new RequestDetails(); + ModelInfo modelInfo = new ModelInfo(); + requestDetails.setModelInfo(modelInfo); + RelatedInstance relatedInstance = new RelatedInstance(); + sIRequest.setRequestDetails(requestDetails); + + List<OrchestrationFlow> result = workflowAction.filterOrchFlows(sIRequest, flows, WorkflowType.VFMODULE, mock(DelegateExecution.class)); assertThat(result, is(flows)); } @@ -103,7 +114,14 @@ public class WorkflowActionUnitTest { "ActivateFabricConfigurationBB", "flow z"); - List<OrchestrationFlow> result = workflowAction.filterOrchFlows(flows, WorkflowType.VFMODULE, mock(DelegateExecution.class)); + ServiceInstancesRequest sIRequest = new ServiceInstancesRequest(); + RequestDetails requestDetails = new RequestDetails(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid(""); + requestDetails.setModelInfo(modelInfo); + sIRequest.setRequestDetails(requestDetails); + + List<OrchestrationFlow> result = workflowAction.filterOrchFlows(sIRequest, flows, WorkflowType.VFMODULE, mock(DelegateExecution.class)); List<OrchestrationFlow> expected = createFlowList( "flow x", "flow y", @@ -147,7 +165,7 @@ public class WorkflowActionUnitTest { doReturn(Arrays.asList(flow)).when(workflowAction).queryNorthBoundRequestCatalogDb(any(), any(), any(), anyBoolean(), any(), any()); workflowAction.selectExecutionList(execution); - verify(workflowAction, times(1)).filterOrchFlows(eq(flows), any(), any()); + verify(workflowAction, times(1)).filterOrchFlows(any(), eq(flows), any(), any()); flow = new OrchestrationFlow(); flow.setFlowName("flow y"); @@ -155,7 +173,7 @@ public class WorkflowActionUnitTest { when(execution.getVariable(eq("aLaCarte"))).thenReturn(false); workflowAction.selectExecutionList(execution); - verify(workflowAction, never()).filterOrchFlows(eq(flows), any(), any()); + verify(workflowAction, never()).filterOrchFlows(any(), eq(flows), any(), any()); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java index 611d793166..6eb22a6dcc 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java @@ -21,7 +21,7 @@ package org.onap.so.bpmn.sdno.tasks; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java index db01399b82..a8e9a7e57e 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java @@ -41,6 +41,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute; import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget; @@ -672,4 +673,21 @@ public class AAIObjectMapperTest { assertThat(actualSubnet, sameBeanAs(expectedSubnet)); } + + @Test + public void mapNetworkPolicyTest() { + NetworkPolicy networkPolicy = new NetworkPolicy(); + networkPolicy.setNetworkPolicyId("testNetworkPolicyId"); + networkPolicy.setNetworkPolicyFqdn("testNetworkPolicyFqdn"); + networkPolicy.setHeatStackId("testHeatStackId"); + + org.onap.aai.domain.yang.NetworkPolicy expectedNetworkPolicy = new org.onap.aai.domain.yang.NetworkPolicy(); + expectedNetworkPolicy.setNetworkPolicyId("testNetworkPolicyId"); + expectedNetworkPolicy.setNetworkPolicyFqdn("testNetworkPolicyFqdn"); + expectedNetworkPolicy.setHeatStackId("testHeatStackId"); + + org.onap.aai.domain.yang.NetworkPolicy actualNetworkPolicy = aaiObjectMapper.mapNetworkPolicy(networkPolicy); + + assertThat(actualNetworkPolicy, sameBeanAs(expectedNetworkPolicy)); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java index 1a86d713a2..4bdbd1a846 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java @@ -22,7 +22,7 @@ package org.onap.so.client.adapter.network.mapper; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.*; -import static org.mockito.Matchers.isA; +import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doReturn; import java.io.UnsupportedEncodingException; @@ -30,6 +30,7 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -99,24 +100,6 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ } @Test - public void testSetNetworkTechnology() { - String networkTechnology = "Contrail"; - NetworkTechnology expectedNetworkTechnology = NetworkTechnology.CONTRAIL; - NetworkTechnology actualNetworkTechnology = SPY_networkAdapterObjectMapper.setNetworkTechnology(networkTechnology); - assertEquals("NetworkTechnology matches", expectedNetworkTechnology, actualNetworkTechnology); - - networkTechnology = "Neutron"; - expectedNetworkTechnology = NetworkTechnology.NEUTRON; - actualNetworkTechnology = SPY_networkAdapterObjectMapper.setNetworkTechnology(networkTechnology); - assertEquals("NetworkTechnology matches", expectedNetworkTechnology, actualNetworkTechnology); - - networkTechnology = "Vmware"; - expectedNetworkTechnology = NetworkTechnology.VMWARE; - actualNetworkTechnology = SPY_networkAdapterObjectMapper.setNetworkTechnology(networkTechnology); - assertEquals("NetworkTechnology matches", expectedNetworkTechnology, actualNetworkTechnology); - - } - @Test public void buildCreateNetworkRequestFromBbobjectTest() throws Exception { String cloudRegionPo = "cloudRegionPo"; @@ -129,12 +112,17 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ expectedCreateNetworkRequest.setNetworkType(l3Network.getNetworkType()); expectedCreateNetworkRequest.setBackout(false); expectedCreateNetworkRequest.setFailIfExists(true); - expectedCreateNetworkRequest.setNetworkTechnology(NetworkTechnology.CONTRAIL); + expectedCreateNetworkRequest.setNetworkTechnology("CONTRAIL"); MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId(requestContext.getMsoRequestId()); msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); expectedCreateNetworkRequest.setMsoRequest(msoRequest); expectedCreateNetworkRequest.setSkipAAI(true); + HashMap<String, String> networkParams = new HashMap<String, String>(); + networkParams.put("shared", "true"); + networkParams.put("external", "false"); + networkParams.put("testUserInputKey", "testUserInputValue"); + expectedCreateNetworkRequest.setNetworkParams(networkParams); expectedCreateNetworkRequest.setNotificationUrl("endpoint/NetworkAResponse/messageId"); @@ -148,13 +136,15 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ subnetList.add(openstackSubnet); l3Network.getSubnets().add(openstackSubnet); l3Network.setNetworkTechnology("Contrail"); + l3Network.setIsSharedNetwork(true); + l3Network.setIsExternalNetwork(false); doReturn("endpoint/").when(SPY_networkAdapterObjectMapper).getEndpoint(); doReturn("messageId").when(SPY_networkAdapterObjectMapper).getRandomUuid(); CreateNetworkRequest createNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer); - assertThat(createNetworkRequest, sameBeanAs(expectedCreateNetworkRequest).ignoring("contrailRequest").ignoring("contrailNetwork").ignoring("providerVlanNetwork").ignoring("subnets").ignoring("networkParams").ignoring("messageId")); + assertThat(createNetworkRequest, sameBeanAs(expectedCreateNetworkRequest).ignoring("contrailRequest").ignoring("contrailNetwork").ignoring("providerVlanNetwork").ignoring("subnets").ignoring("messageId")); } @Test @@ -243,6 +233,12 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ l3Network.getSubnets().add(actualSubnet); l3Network.getNetworkPolicies().add(networkPolicy); l3Network.getContrailNetworkRouteTableReferences().add(routeTableReference); + l3Network.setIsSharedNetwork(false); + l3Network.setIsExternalNetwork(false); + HashMap<String, String> networkParams = new HashMap<String, String>(); + networkParams.put("shared", "false"); + networkParams.put("external", "false"); + networkParams.put("testUserInputKey", "testUserInputValue"); UpdateNetworkRequest expectedUpdateNetworkRequest = new UpdateNetworkRequest(); expectedUpdateNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); @@ -256,7 +252,7 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ expectedUpdateNetworkRequest.setSubnets(subnets); expectedUpdateNetworkRequest.setProviderVlanNetwork(providerVlanNetwork); expectedUpdateNetworkRequest.setContrailNetwork(contrailNetwork); - expectedUpdateNetworkRequest.setNetworkParams(userInput); + expectedUpdateNetworkRequest.setNetworkParams(networkParams); expectedUpdateNetworkRequest.setMsoRequest(msoRequest); expectedUpdateNetworkRequest.setSkipAAI(true); expectedUpdateNetworkRequest.setBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled())); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java index 99e76450af..339e9cbf17 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java @@ -230,7 +230,16 @@ public class VnfAdapterObjectMapperTest { } @Test - public void test_deleteVolumeGroupRequestMapper() throws Exception { + public void test_deleteVolumeGroupHeatIdRequestMapper() throws Exception{ + this.test_deleteVolumeGroupRequestMapper("heatStackId"); + } + + @Test + public void test_deleteVolumeGroupNoHeatIdRequestMapper() throws Exception{ + this.test_deleteVolumeGroupRequestMapper(null); + } + + private void test_deleteVolumeGroupRequestMapper(String heatStackId) throws Exception { DeleteVolumeGroupRequest expectedDeleteVolumeGroupRequest = new DeleteVolumeGroupRequest(); CloudRegion cloudRegion = new CloudRegion(); @@ -244,8 +253,13 @@ public class VnfAdapterObjectMapperTest { volumeGroup.setVolumeGroupId("volumeGroupId"); expectedDeleteVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId()); - volumeGroup.setHeatStackId("heatStackId"); - expectedDeleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId()); + if (heatStackId != null){ + volumeGroup.setHeatStackId("heatStackId"); + expectedDeleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId()); + } else { + volumeGroup.setVolumeGroupName("volumeGroupName"); + expectedDeleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getVolumeGroupName()); + } expectedDeleteVolumeGroupRequest.setSkipAAI(true); @@ -269,7 +283,7 @@ public class VnfAdapterObjectMapperTest { assertThat(actualDeleteVolumeGroupRequest, sameBeanAs(expectedDeleteVolumeGroupRequest)); } - + @Test @Ignore public void test_createVolumeGroupParams() throws Exception { diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java index 32a495e094..a156c382d1 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java @@ -845,7 +845,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest { jsonToCompare, DeleteVfModuleRequest.class); - assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl").ignoring("vfModuleStackId")); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java index c8f4a222f3..160feed426 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java @@ -20,19 +20,38 @@ package org.onap.so.client.adapter.vnf.mapper; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doNothing; import java.util.Arrays; import java.util.HashMap; import java.util.Map; +import org.junit.Before; import org.junit.Test; +import org.mockito.MockitoAnnotations; +import org.mockito.Spy; +import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.entity.MsoRequest; -public class VnfAdapterVfModuleObjectMapperTest{ +public class VnfAdapterVfModuleObjectMapperTest { + @Spy private VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); + + @Before + public void before() { + MockitoAnnotations.initMocks(this); + } @Test public void createVnfcSubInterfaceKeyTest() { @@ -64,4 +83,42 @@ public class VnfAdapterVfModuleObjectMapperTest{ } + @Test + public void test_deleteVfModuleNoHeatIdRequestMapper() throws Exception { + DeleteVfModuleRequest expectedDeleteVfModuleRequest = new DeleteVfModuleRequest(); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("lcpCloudRegionId"); + expectedDeleteVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); + + cloudRegion.setTenantId("tenantId"); + expectedDeleteVfModuleRequest.setTenantId(cloudRegion.getTenantId()); + + GenericVnf genericVnf = new GenericVnf(); + VfModule vfModule = new VfModule(); + vfModule.setHeatStackId("heatStackId"); + expectedDeleteVfModuleRequest.setVfModuleStackId("heatStackId"); + expectedDeleteVfModuleRequest.setSkipAAI(true); + + MsoRequest msoRequest = new MsoRequest(); + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId("msoRequestId"); + msoRequest.setRequestId(requestContext.getMsoRequestId()); + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + expectedDeleteVfModuleRequest.setMsoRequest(msoRequest); + + String messageId = "messageId"; + String endpoint = "endpoint"; + doNothing().when(mapper).setIdAndUrl(any()); + expectedDeleteVfModuleRequest.setMessageId(messageId); + expectedDeleteVfModuleRequest.setNotificationUrl(endpoint + "/VNFAResponse/" + messageId); + + DeleteVfModuleRequest actualDeleteVfModuleRequest = mapper.deleteVfModuleRequestMapper(requestContext, cloudRegion, + serviceInstance, genericVnf, vfModule); + + assertThat(actualDeleteVfModuleRequest, sameBeanAs(expectedDeleteVfModuleRequest).ignoring("messageId").ignoring("notificationUrl")); + } + } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java index 11e542be7b..8bf3de5c4e 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java @@ -21,7 +21,7 @@ package org.onap.so.client.orchestration; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java index 8b16964ab5..a38c8be686 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java @@ -21,7 +21,7 @@ package org.onap.so.client.orchestration; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java index e19458f21d..10bbf39823 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java @@ -20,7 +20,7 @@ package org.onap.so.client.orchestration; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java index f20c646657..2e2cc5d974 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java @@ -26,7 +26,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; @@ -45,7 +45,6 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; -import org.onap.aai.domain.yang.NetworkPolicy; import org.onap.aai.domain.yang.RouteTableReference; import org.onap.aai.domain.yang.VpnBinding; import org.onap.so.bpmn.common.InjectionHelper; @@ -54,6 +53,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; import org.onap.so.client.aai.AAIObjectType; @@ -77,6 +77,7 @@ public class AAINetworkResourcesTest extends TestDataSetup{ private ServiceInstance serviceInstance; private CloudRegion cloudRegion; private Subnet subnet; + private NetworkPolicy networkPolicy; @Mock protected AAIResourcesClient MOCK_aaiResourcesClient; @@ -107,6 +108,8 @@ public class AAINetworkResourcesTest extends TestDataSetup{ subnet = buildSubnet(); + networkPolicy = buildNetworkPolicy(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); } @@ -175,16 +178,15 @@ public class AAINetworkResourcesTest extends TestDataSetup{ public void getNetworkPolicyTest() throws Exception { final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPolicy.json"))); AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); - Optional<NetworkPolicy> oNetPolicy = Optional.empty(); + Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy = Optional.empty(); AAIResourceUri netPolicyUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, "ModelInvariantUUID"); doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); oNetPolicy = aaiNetworkResources.getNetworkPolicy(netPolicyUri); - verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class)); - + verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class)); if (oNetPolicy.isPresent()) { - NetworkPolicy networkPolicy = oNetPolicy.get(); - assertThat(aaiResultWrapper.asBean(NetworkPolicy.class).get(), sameBeanAs(networkPolicy)); + org.onap.aai.domain.yang.NetworkPolicy networkPolicy = oNetPolicy.get(); + assertThat(aaiResultWrapper.asBean(org.onap.aai.domain.yang.NetworkPolicy.class).get(), sameBeanAs(networkPolicy)); } } @@ -357,4 +359,20 @@ public class AAINetworkResourcesTest extends TestDataSetup{ assertThat(aaiResultWrapper.asBean(org.onap.aai.domain.yang.Subnet.class).get(), sameBeanAs(subnet)); } } + + @Test + public void createNetworkPolicyTest() throws Exception { + doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.NetworkPolicy.class)); + doReturn(new org.onap.aai.domain.yang.NetworkPolicy()).when(MOCK_aaiObjectMapper).mapNetworkPolicy(networkPolicy); + aaiNetworkResources.createNetworkPolicy(networkPolicy); + verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.NetworkPolicy.class)); + } + + @Test + public void deleteNetworkPolicyTest() throws Exception { + doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class)); + aaiNetworkResources.deleteNetworkPolicy(networkPolicy.getNetworkPolicyId()); + verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class)); + } + } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java index 0a8e7ce349..a8200caf79 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java @@ -138,4 +138,17 @@ public class AAIVfModuleResourcesTest extends TestDataSetup{ assertEquals("testHeatStackId", vfModule.getHeatStackId()); } + + @Test + public void updateContrailServiceInstanceFqdnVfModuleTest() throws Exception { + vfModule.setContrailServiceInstanceFqdn("testContrailServiceInstanceFqdn"); + + doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VfModule.class)); + + aaiVfModuleResources.updateContrailServiceInstanceFqdnVfModule(vfModule, vnf); + + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class),ArgumentMatchers.isNull()); + + assertEquals("testContrailServiceInstanceFqdn", vfModule.getContrailServiceInstanceFqdn()); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java index c28bc05dcb..b87b5e4166 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java @@ -22,7 +22,7 @@ package org.onap.so.client.orchestration; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java index 77e56751d4..c50b084df2 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java @@ -22,7 +22,7 @@ package org.onap.so.client.orchestration; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNOHealthCheckResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNOHealthCheckResourcesTest.java index 44263fa3f5..46d87c7ca3 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNOHealthCheckResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNOHealthCheckResourcesTest.java @@ -21,7 +21,7 @@ package org.onap.so.client.orchestration; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.ArgumentMatchers.any; diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json index a9cef565df..d7e282dda7 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json @@ -13,9 +13,13 @@ "cidr": "107.244.64.2/20", "gatewayIp": "107.244.64.1", "ipVersion": "4", - "enableDHCP": false, + "enableDHCP": true, "addrFromStart": true, - "hostRoutes": [] + "hostRoutes": [], + "allocationPools": [{ + "start": "107.244.64.2", + "end": "107.244.64.16" + }] } ], "providerVlanNetwork": { diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/generalBB.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/generalBB.json index 6c6981b96a..e0b3bc4ff9 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/generalBB.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/generalBB.json @@ -64,9 +64,9 @@ "cidr-mask" : "20", "ip-version" : "4", "orchestration-status" : null, - "dhcp-enabled" : false, - "dhcp-start" : "", - "dhcp-end" : "", + "dhcp-enabled" : true, + "dhcp-start" : "107.244.64.2", + "dhcp-end" : "107.244.64.16", "subnet-role" : "", "ip-assignment-direction" : "true", "subnet-sequence" : null, diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json index b65203b24d..83ecd6add1 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json @@ -42,13 +42,13 @@ "modelInvariantId" : "testProxyModelInvariantUuid2" }, "requiredCandidates" : [ { - "candidateType" : { + "identifierType" : { "name" : "vnfId" }, - "candidates" : [ "testVnfId" ] + "identifiers" : [ "testVnfId" ] } ] } ], - "requestParameters" : {"subscriptionServiceType":"iptollfree","aLaCarte":false} + "requestParameters" : {"subscriptionServiceType":"testSubscriptionServiceType","aLaCarte":false} }, "licenseInfo" : { "licenseDemands" : [ ] diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json index ac460c328a..740a05d1be 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json @@ -51,7 +51,7 @@ "modelInvariantId" : "testAllottedModelInvariantUuid3" } } ], - "requestParameters" : {"subscriptionServiceType":"iptollfree","aLaCarte":false} + "requestParameters" : {"subscriptionServiceType":"testSubscriptionServiceType","aLaCarte":false} }, "licenseInfo" : { "licenseDemands" : [ ] diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json index 6db2153691..c3c5c0771a 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json @@ -42,10 +42,10 @@ "modelInvariantId" : "testProxyModelInvariantUuid2" }, "requiredCandidates" : [ { - "candidateType" : { + "identifierType" : { "name" : "vnfId" }, - "candidates" : [ "testVnfId" ] + "identifiers" : [ "testVnfId" ] } ] }, { "serviceResourceId" : "testProxyId1", @@ -66,10 +66,10 @@ "modelInvariantId" : "testProxyModelInvariantUuid2" }, "requiredCandidates" : [ { - "candidateType" : { + "identifierType" : { "name" : "vnfId" }, - "candidates" : [ "testVnfId" ] + "identifiers" : [ "testVnfId" ] } ] }, { "serviceResourceId" : "testProxyId1", @@ -90,13 +90,13 @@ "modelInvariantId" : "testProxyModelInvariantUuid2" }, "requiredCandidates" : [ { - "candidateType" : { + "identifierType" : { "name" : "vnfId" }, - "candidates" : [ "testVnfId" ] + "identifiers" : [ "testVnfId" ] } ] } ], - "requestParameters" : {"subscriptionServiceType":"iptollfree","aLaCarte":false} + "requestParameters" : {"subscriptionServiceType":"testSubscriptionServiceType","aLaCarte":false} }, "licenseInfo" : { "licenseDemands" : [ ] diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterDeleteVfModuleRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterDeleteVfModuleRequest.json index 21e5bde3ec..1d2e7d090f 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterDeleteVfModuleRequest.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterDeleteVfModuleRequest.json @@ -2,7 +2,8 @@ "cloudSiteId" : "cloudRegionId", "tenantId" : "tenantId", "vnfId" : "vnfId", - "vfModuleId" : "vfModuleId", + "vfModuleId" : "vfModuleId", + "vfModuleStackId" : "vfModuleName", "skipAAI" : true, "msoRequest" : { "requestId" : "requestId", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModuleCreateWithFabric.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModuleCreateWithFabric.json new file mode 100644 index 0000000000..332ad4500c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModuleCreateWithFabric.json @@ -0,0 +1,65 @@ +{ + "requestDetails": { + "modelInfo": { + "modelCustomizationName": "model-cust-name", + "modelInvariantId": "db86e4a6-c027-452e-a559-3a23b3128367", + "modelType": "vfModule", + "modelName": "test-model-name", + "modelVersion": "1", + "modelCustomizationUuid": "9a6d01fd-19a7-490a-9800-460830a12e0b", + "modelVersionId": "14c8f313-fb0f-4cf6-8caf-c7cce8137b60", + "modelCustomizationId": "9a6d01fd-19a7-490a-9800-460830a12e0b", + "modelUuid": "14c8f313-fb0f-4cf6-8caf-c7cce8137b60", + "modelInvariantUuid": "db86e4a6-c027-452e-a559-3a23b3128367", + "modelInstanceName": "test-model-instance-name" + }, + "requestInfo": { + "source": "VID", + "instanceName": "instanceName", + "suppressRollback": false, + "requestorId": "user" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "f647e3ef-6d2e-4cd3-bff4-8df4634208de", + "modelInfo": { + "modelInvariantId": "86adb376-5303-441a-b50e-96c0cd643b0f", + "modelType": "service", + "modelName": "model-name", + "modelVersion": "1.0", + "modelVersionId": "599e21ed-803d-4d1f-83df-20005339b83f", + "modelUuid": "599e21ed-803d-4d1f-83df-20005339b83f", + "modelInvariantUuid": "86adb376-5303-441a-b50e-96c0cd643b0f" + } + } + }, + { + "relatedInstance": { + "instanceId": "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d", + "modelInfo": { + "modelCustomizationName": "modle-cust-name", + "modelInvariantId": "5cca9285-4ed4-4e11-a609-921ed3344811", + "modelType": "vnf", + "modelName": "modle-name", + "modelVersion": "1.0", + "modelCustomizationUuid": "fc25201d-36d6-43a3-8d39-fdae88e526ae", + "modelVersionId": "7cae703a-b20d-481a-863a-b862236c00f7", + "modelCustomizationId": "fc25201d-36d6-43a3-8d39-fdae88e526ae", + "modelUuid": "7cae703a-b20d-481a-863a-b862236c00f7", + "modelInvariantUuid": "5cca9285-4ed4-4e11-a609-921ed3344811", + "modelInstanceName": "model-inst-name" + } + } + } + ], + "cloudConfiguration": { + "tenantId": "872f331350c54e59991a8de2cbffb40c", + "cloudOwner": "my-custom-cloud-owner", + "lcpCloudRegionId": "cloud-region" + }, + "requestParameters": { + "usePreload": true + } + } +}
\ No newline at end of file |