diff options
11 files changed, 151 insertions, 109 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.10__CvnfcCustomizationNullableColumn.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.10__CvnfcCustomizationNullableColumn.sql new file mode 100644 index 0000000000..985c7cd44d --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.10__CvnfcCustomizationNullableColumn.sql @@ -0,0 +1,4 @@ +use catalogdb; + +ALTER TABLE cvnfc_customization + MODIFY IF EXISTS VNFC_CUST_MODEL_CUSTOMIZATION_UUID varchar(200) NULL;
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.9__DeleteServiceRecipeOldMacro.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.9__DeleteServiceRecipeOldMacro.sql new file mode 100644 index 0000000000..7fd222a027 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.9__DeleteServiceRecipeOldMacro.sql @@ -0,0 +1,5 @@ +use catalogdb; + +DELETE FROM catalogdb.service_recipe + where orchestration_uri = '/mso/async/services/CreateGenericMacroServiceNetworkVnf' + or orchestration_uri = '/mso/async/services/DeleteGenericMacroServiceNetworkVnf';
\ No newline at end of file diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml index f9f7127d17..28fd24c0c8 100644 --- a/asdc-controller/pom.xml +++ b/asdc-controller/pom.xml @@ -196,12 +196,12 @@ <dependency> <groupId>org.onap.sdc.sdc-tosca</groupId> <artifactId>sdc-tosca</artifactId> - <version>1.4.1</version> + <version>1.3.5</version> </dependency> <dependency> <groupId>org.onap.sdc.jtosca</groupId> <artifactId>jtosca</artifactId> - <version>1.4.1</version> + <version>1.3.5</version> </dependency> <dependency> <groupId>org.onap.so</groupId> diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index 70831bc828..f7b457c718 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -101,6 +101,7 @@ import org.onap.so.db.catalog.data.repository.InstanceGroupRepository; import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.NetworkResourceRepository; import org.onap.so.db.catalog.data.repository.ServiceProxyResourceCustomizationRepository; +import org.onap.so.db.catalog.data.repository.ServiceProxyResourceRepository; import org.onap.so.db.catalog.data.repository.ServiceRepository; import org.onap.so.db.catalog.data.repository.TempNetworkHeatTemplateRepository; import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository; @@ -151,6 +152,9 @@ public class ToscaResourceInstaller { protected ServiceProxyResourceCustomizationRepository serviceProxyCustomizationRepo; @Autowired + protected ServiceProxyResourceRepository serviceProxyRepo; + + @Autowired protected CollectionResourceRepository collectionRepo; @Autowired @@ -386,32 +390,48 @@ public class ToscaResourceInstaller { } } } - + protected void processServiceProxyAndConfiguration(ToscaResourceStructure toscaResourceStruct, Service service) { List<NodeTemplate> serviceProxyResourceList = toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.SERVICE_PROXY); List<NodeTemplate> configurationNodeTemplatesList = toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CONFIGURATION); + List<ServiceProxyResourceCustomization> serviceProxyList = new ArrayList<ServiceProxyResourceCustomization>(); + List<ConfigurationResourceCustomization> configurationResourceList = new ArrayList<ConfigurationResourceCustomization>(); + + ServiceProxyResourceCustomization serviceProxy = null; + if (serviceProxyResourceList != null) { for (NodeTemplate spNode : serviceProxyResourceList) { - createServiceProxy(spNode, service, toscaResourceStruct); - serviceProxyCustomizationRepo.saveAndFlush(toscaResourceStruct.getCatalogServiceProxyResourceCustomization()); + serviceProxy = createServiceProxy(spNode, service, toscaResourceStruct); + + ServiceProxyResource serviceProxyResource = findExistingServiceProxyResource(serviceProxyList, serviceProxy.getServiceProxyResource().getModelUUID()); + + if(serviceProxyResource == null){ + + serviceProxyList.add(serviceProxy); for (NodeTemplate configNode : configurationNodeTemplatesList) { - + List<RequirementAssignment> requirementsList = toscaResourceStruct.getSdcCsarHelper().getRequirementsOf(configNode).getAll(); for (RequirementAssignment requirement : requirementsList) { if (requirement.getNodeTemplateName().equals(spNode.getName())) { - createConfiguration(configNode, toscaResourceStruct, toscaResourceStruct.getCatalogServiceProxyResourceCustomization()); - configCustomizationRepo.saveAndFlush(toscaResourceStruct.getCatalogConfigurationResourceCustomization()); + ConfigurationResourceCustomization configurationResource = createConfiguration(configNode, toscaResourceStruct, serviceProxy); + + configurationResourceList.add(configurationResource); break; } } } + + } } } + + service.setConfigurationCustomizations(configurationResourceList); + service.setServiceProxyCustomizations(serviceProxyList); } protected void processNetworkCollections(ToscaResourceStructure toscaResourceStruct, Service service) { @@ -731,9 +751,6 @@ public class ToscaResourceInstaller { spCustomizationResource.setServiceProxyResource(spResource); serviceProxyCustomizationSet.add(spCustomizationResource); - - spResource.setServiceProxyCustomization(serviceProxyCustomizationSet); - toscaResourceStructure.setCatalogServiceProxyResource(spResource); toscaResourceStructure.setCatalogServiceProxyResourceCustomization(spCustomizationResource); @@ -1237,8 +1254,6 @@ public class ToscaResourceInstaller { vnfcCustomizations.add(vnfcCustomization); } - } - CvnfcCustomization cvnfcCustomization = new CvnfcCustomization(); cvnfcCustomization.setModelCustomizationUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); cvnfcCustomization.setModelInstanceName(cvfcTemplate.getName()); @@ -1293,11 +1308,12 @@ public class ToscaResourceInstaller { vnfVfmoduleCvnfcConfigurationCustomizations.add(vnfVfmoduleCvnfcConfigurationCustomization); } + } + } } - vfModuleCustomization.setVnfcCustomization(vnfcCustomizations); vfModuleCustomization.setCvnfcCustomization(cvnfcCustomizations); vfModuleCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizations); @@ -1350,6 +1366,20 @@ public class ToscaResourceInstaller { return configResource; } + protected ServiceProxyResource findExistingServiceProxyResource(List<ServiceProxyResourceCustomization> serviceProxyList, String modelUUID) { + ServiceProxyResource serviceProxyResource = null; + for(ServiceProxyResourceCustomization serviceProxyResourceCustom : serviceProxyList){ + if (serviceProxyResourceCustom.getServiceProxyResource() != null + && serviceProxyResourceCustom.getServiceProxyResource().getModelUUID().equals(modelUUID)) { + serviceProxyResource = serviceProxyResourceCustom.getServiceProxyResource(); + } + } + if(serviceProxyResource==null) + serviceProxyResource = serviceProxyRepo.findResourceByModelUUID(modelUUID); + + return serviceProxyResource; + } + protected VfModuleCustomization findExistingVfModuleCustomization(VnfResourceCustomization vnfResource, String vfModuleModelCustomizationUUID) { VfModuleCustomization vfModuleCustomization = null; 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 8e36cc5f8c..fc48996b9b 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 @@ -890,7 +890,7 @@ public class BBInputSetup implements JavaDelegate { if (bbName.contains(NETWORK) && !bbName.contains(NETWORK_COLLECTION)) { String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID); ModelInfo networkModelInfo = new ModelInfo(); - if(!Boolean.TRUE.equals(executeBB.getBuildingBlock().getIsVirtualLink())) { + if((!Boolean.TRUE.equals(executeBB.getBuildingBlock().getIsVirtualLink()))) { NetworkResourceCustomization networkCust = getNetworkCustomizationByKey(key, service); if (networkCust != null) { networkModelInfo.setModelCustomizationUuid(networkCust.getModelCustomizationUUID()); @@ -901,7 +901,13 @@ public class BBInputSetup implements JavaDelegate { } } else { msoLogger.debug("Orchestrating on Collection Network Resource Customization"); - serviceInstance.getNetworks().add(getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId)); + CollectionNetworkResourceCustomization collectionNetworkResourceCust = bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key); + L3Network l3Network = getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId, collectionNetworkResourceCust, serviceInstance); + NetworkResourceCustomization networkResourceCustomization = + mapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust); + if(l3Network != null) { + l3Network.setModelInfoNetwork(mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization)); + } } } else if(bbName.contains("Configuration")) { String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID); @@ -917,15 +923,18 @@ public class BBInputSetup implements JavaDelegate { } protected L3Network getVirtualLinkL3Network(Map<ResourceKey, String> lookupKeyMap, String bbName, String key, - String networkId) { - CollectionNetworkResourceCustomization collectionNetworkResourceCust = bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key); - if(collectionNetworkResourceCust != null && (bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) + String networkId, CollectionNetworkResourceCustomization collectionNetworkResourceCust, ServiceInstance serviceInstance) { + if(collectionNetworkResourceCust != null) { + if((bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { - NetworkResourceCustomization networkResourceCustomization = - mapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust); - L3Network l3Network = createNetwork(lookupKeyMap, null, networkId, null); - l3Network.setModelInfoNetwork(mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization)); - return l3Network; + serviceInstance.getNetworks().add(createNetwork(lookupKeyMap, null, networkId, null)); + } else { + for (L3Network network : serviceInstance.getNetworks()) { + if (network.getNetworkId().equalsIgnoreCase(networkId)) { + return network; + } + } + } } return null; } diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn index 31a981729b..67bd961844 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.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="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" 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="_EsMs0HcuEeW2U_kkOHX1ZQ" 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="CompleteMsoProcess" name="CompleteMsoProcess" isExecutable="true"> <bpmn2:scriptTask id="preProcessRequest" name="Pre-Process Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_18</bpmn2:incoming> @@ -101,6 +101,7 @@ buildDataErrorMessage.buildDataError(execution, "Complete MSO -- Update DB stat <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> <camunda:in variables="all" /> <camunda:out variables="all" /> + <camunda:in businessKey="#{execution.processBusinessKey}" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_81</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_13qdn1s</bpmn2:outgoing> diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java index c7d1a7c81f..3b41ff8337 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -44,16 +44,6 @@ public class StubResponseAAI { /** - * Tunnel-XConnect Mock Stub Response - */ - public static void MockPutTunnelXConnect(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String tunnelId){ - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "/tunnel-xconnects/tunnel-xconnect/" + tunnelId)) - .willReturn(aResponse() - .withStatus(200))); - } - - - /** * Allotted Resource Mock StubResponses below */ public static void MockGetAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String responseFile) { @@ -63,7 +53,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockPutAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) .willReturn(aResponse() @@ -75,13 +65,13 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(500))); } - + public static void MockDeleteAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String resourceVersion) { stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(204))); } - + public static void MockPatchAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { stubFor(patch(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) .willReturn(aResponse() @@ -183,26 +173,26 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(204))); } - + public static void MockGetServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(statusCode))); } - + public static void MockGetServiceInstance(String customer, String serviceSubscription, int statusCode){ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml"))); } - + public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){ stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(statusCode))); } - + public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){ stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" +1234)) .willReturn(aResponse() @@ -263,7 +253,7 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(200))); } - + public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, int statusCode) { stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) .willReturn(aResponse() @@ -303,7 +293,7 @@ public class StubResponseAAI { /** * Generic-Vnf Mock StubResponses below */ - + public static void MockGetGenericVnfById(String vnfId, String responseFile){ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1")) .willReturn(aResponse() @@ -311,7 +301,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetGenericVnfById(String vnfId, String responseFile, int statusCode){ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) .willReturn(aResponse() @@ -319,23 +309,23 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetGenericVnfByIdWithPriority(String vnfId, int statusCode, String responseFile) { stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) .atPriority(1) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); + .withBodyFile(responseFile))); } - + public static void MockGetGenericVnfByIdWithPriority(String vnfId, String vfModuleId, int statusCode, String responseFile, int priority) { stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) .atPriority(priority) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); + .withBodyFile(responseFile))); } public static void MockGetGenericVnfByIdWithDepth(String vnfId, int depth, String responseFile){ @@ -345,7 +335,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetGenericVnfById_404(String vnfId){ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) .willReturn(aResponse() @@ -366,7 +356,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetGenericVnfByNameWithDepth(String vnfName, int depth, String responseFile){ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName + "[&]depth=" + depth)) .willReturn(aResponse() @@ -404,7 +394,7 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(200))); } - + public static void MockPutGenericVnf(String vnfId, String requestBodyContaining, int statusCode) { stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) .withRequestBody(containing(requestBodyContaining)) @@ -417,7 +407,7 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(statusCode))); } - + public static void MockPutGenericVnf_Bad(String vnfId, int statusCode){ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) .willReturn(aResponse() @@ -459,7 +449,7 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(200))); } - + public static void MockGetGenericVceByNameWithDepth(String vnfName, int depth, String responseFile){ stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName + "[&]depth=" + depth)) .willReturn(aResponse() @@ -505,7 +495,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetNetworkByIdWithDepth(String networkId, String responseFile, String depth) { stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "[?]depth=" + depth)) .willReturn(aResponse() @@ -513,7 +503,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetNetworkCloudRegion(String responseFile, String cloudRegion) { stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion)) .willReturn(aResponse() @@ -521,7 +511,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetNetworkByName(String networkName, String responseFile) { stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName)) .willReturn(aResponse() @@ -537,7 +527,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetNetworkCloudRegion_404(String cloudRegion) { stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion)) .willReturn(aResponse() @@ -551,7 +541,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockPutNetwork(String networkPolicyId, String responseFile, int statusCode) { stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicyId)) .willReturn(aResponse() @@ -559,7 +549,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetNetworkName(String networkPolicyName, String responseFile, int statusCode) { stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkPolicyName)) .willReturn(aResponse() @@ -574,8 +564,8 @@ public class StubResponseAAI { .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); - } - + } + public static void MockGetNetworkPolicy(String responseFile, String policy) { stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/"+policy + "[?]depth=all")) .willReturn(aResponse() @@ -583,7 +573,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetNetworkVpnBinding(String networkBindingId, String responseFile, int statusCode) { stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + networkBindingId)) .willReturn(aResponse() @@ -591,7 +581,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetNetworkPolicy(String networkPolicy, String responseFile, int statusCode) { stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicy)) .willReturn(aResponse() @@ -599,7 +589,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetNetworkTableReference(String responseFile, String tableReference) { stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/"+tableReference + "[?]depth=all")) .willReturn(aResponse() @@ -607,7 +597,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockPutNetworkIdWithDepth(String responseFile, String networkId, String depth) { stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/"+networkId+"[?]depth="+depth )) .willReturn(aResponse() @@ -615,7 +605,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetNetworkPolicyfqdn(String networkPolicy, String responseFile, int statusCode) { stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy[?]network-policy-fqdn=" + networkPolicy)) .willReturn(aResponse() @@ -623,7 +613,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetNetworkRouteTable(String networkRouteId, String responseFile, int statusCode) { stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/" + networkRouteId)) .willReturn(aResponse() @@ -631,15 +621,15 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockPatchVfModuleId(String vnfId, String vfModuleId) { stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) .willReturn(aResponse() .withStatus(200))); } - + ///////////// - + public static void MockVNFAdapterRestVfModule() { stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool")) .willReturn(aResponse() @@ -658,7 +648,7 @@ public class StubResponseAAI { .withStatus(202) .withHeader("Content-Type", "application/xml"))); } - + public static void MockDBUpdateVfModule(){ stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) .willReturn(aResponse() @@ -666,7 +656,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile("VfModularity/DBUpdateResponse.xml"))); } - + // start of mocks used locally and by other VF Module unit tests public static void MockSDNCAdapterVfModule() { // simplified the implementation to return "success" for all requests @@ -678,7 +668,7 @@ public class StubResponseAAI { .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml"))); } - + // start of mocks used locally and by other VF Module unit tests public static void MockAAIVfModule() { stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool")) @@ -686,7 +676,7 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") - .withBodyFile("VfModularity/VfModule-supercool.xml"))); + .withBodyFile("VfModularity/VfModule-supercool.xml"))); stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/lukewarm")) .atPriority(2) .willReturn(aResponse() @@ -758,14 +748,14 @@ public class StubResponseAAI { .withStatus(200))); } - - + + ////////////// /** * Cloud infrastructure below */ - + public static void MockGetCloudRegion(String cloudRegionId, int statusCode, String responseFile) { stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId)) .willReturn(aResponse() @@ -773,14 +763,14 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + /** * Volume Group StubResponse below */ public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile) { MockGetVolumeGroupById(cloudRegionId, volumeGroupId, responseFile, 200); } - + public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int responseCode) { stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId)) .willReturn(aResponse() @@ -788,7 +778,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockPutVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int statusCode) { stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId)) .willReturn(aResponse() @@ -796,7 +786,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetVolumeGroupByName(String cloudRegionId, String volumeGroupName, String responseFile, int statusCode) { stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName)) .willReturn(aResponse() @@ -804,7 +794,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockDeleteVolumeGroupById(String cloudRegionId, String volumeGroupId, String resourceVersion, int statusCode) { stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() @@ -816,13 +806,13 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(404))); } - + public static void MockDeleteVolumeGroup(String cloudRegionId, String volumeGroupId, String resourceVersion) { stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(200))); } - + /** * VF-Module StubResponse below * @param statusCode TODO @@ -834,7 +824,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetVfModuleByNameWithDepth(String vnfId, String vfModuleName, int depth, String responseFile, int statusCode) { stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName + "[?]depth=" + depth)) .willReturn(aResponse() @@ -842,7 +832,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetVfModuleByName(String vnfId, String vfModuleName, String responseFile, int statusCode) { stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName)) .willReturn(aResponse() @@ -850,7 +840,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) { stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) .withRequestBody(containing(requestContaining)) @@ -865,19 +855,19 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(200))); } - + public static void MockPutVfModuleId(String vnfId, String vfModuleId) { stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) .willReturn(aResponse() .withStatus(200))); } - + public static void MockPutVfModuleId(String vnfId, String vfModuleId, int returnCode) { stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) .willReturn(aResponse() .withStatus(returnCode))); } - + public static void MockDeleteVfModuleId(String vnfId, String vfModuleId, String resourceVersion, int returnCode) { stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId + "/[?]resource-version=" + resourceVersion)) .willReturn(aResponse() @@ -889,7 +879,7 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(statusCode))); } - + /* AAI Pserver Queries */ public static void MockGetPserverByVnfId(String vnfId, String responseFile, int statusCode) { stubFor(put(urlMatching("/aai/v1[0-9]/query.*")) @@ -898,7 +888,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "application/json") .withBodyFile(responseFile))); } - + public static void MockGetGenericVnfsByVnfId(String vnfId, String responseFile, int statusCode) { stubFor(get(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*")) .willReturn(aResponse() @@ -906,14 +896,14 @@ public class StubResponseAAI { .withHeader("Content-Type", "application/json; charset=utf-8") .withBodyFile(responseFile))); } - + public static void MockSetInMaintFlagByVnfId(String vnfId, int statusCode) { stubFor(patch(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*")) .willReturn(aResponse() - .withStatus(statusCode) + .withStatus(statusCode) )); } - + public static void MockSetInMaintFlagByVnfId(String vnfId, String responseFile, int statusCode) { stubFor(post(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*")) .willReturn(aResponse() @@ -921,7 +911,7 @@ public class StubResponseAAI { .withBodyFile(responseFile) )); } - + public static void MockGetDefaultCloudRegionByCloudRegionId(String cloudRegionId, String responseFile, int statusCode) { stubFor(get(urlMatching("/aai/v1[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegionId + ".*")) .willReturn(aResponse() @@ -929,7 +919,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "application/json; charset=utf-8") .withBodyFile(responseFile))); } - + //// Deprecated Stubs below - to be deleted once unit test that reference them are refactored to use common ones above //// @Deprecated public static void MockGetVceById(){ 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 a5795f923c..9897c04ad8 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 @@ -1804,6 +1804,7 @@ public class BBInputSetupTest { doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + executeBB.getBuildingBlock().setIsVirtualLink(Boolean.FALSE); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); verify(SPY_bbInputSetup, times(1)).getGBBMacroNoUserParamsCreate(any(ExecuteBuildingBlock.class), any(), any(String.class), any(String.class), any(GeneralBuildingBlock.class), any(Service.class)); @@ -2047,18 +2048,20 @@ public class BBInputSetupTest { doReturn(networkResourceCustomization).when(bbInputSetupMapperLayer).mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust); ModelInfoNetwork modelInfoNetwork = Mockito.mock(ModelInfoNetwork.class); doReturn(modelInfoNetwork ).when(bbInputSetupMapperLayer).mapCatalogNetworkToNetwork(networkResourceCustomization); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); executeBB.getBuildingBlock().setIsVirtualLink(true); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); verify(SPY_bbInputSetup, times(2)).getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, executeBB.getBuildingBlock().getBpmnFlowName(), "ab153b6e-c364-44c0-bef6-1f2982117f04", gBB, service); - executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.FABRIC_CONFIGURATION.toString()); - executeBB.getBuildingBlock().setKey("modelCustId"); - doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(isA(Configuration.class), isA(ModelInfo.class), isA(Service.class), isA(ConfigurationResourceKeys.class)); + + executeBB.getBuildingBlock().setBpmnFlowName("CreateNetworkBB"); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + executeBB.getBuildingBlock().setIsVirtualLink(true); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); verify(SPY_bbInputSetup, times(1)).getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, - executeBB.getBuildingBlock().getBpmnFlowName(), "modelCustId", gBB, service); + executeBB.getBuildingBlock().getBpmnFlowName(), "ab153b6e-c364-44c0-bef6-1f2982117f04", gBB, service); } @Test diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java index 8ebc80c4c2..9dadb8b623 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java @@ -1487,7 +1487,7 @@ public abstract class WorkflowTest { for(Resource resource:resourceList){ resourceId = resource.getResourceId(); } - String homingList = getJsonValue(content, "solutionInfo.placement"); + String homingList = getJsonValue(content, "solutionInfo.placementInfo"); JSONArray placementArr = null; try { placementArr = new JSONArray(homingList); 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 df4698de9d..1585a7bb74 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 @@ -260,7 +260,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { if(resourceClient.exists(uri)){ Map<String, String> keys = uri.getURIKeys() - execution.setVariable("globalCustomer", keys.get("global-customer-id")) + execution.setVariable("globalCustomerId", keys.get("global-customer-id")) execution.setVariable("serviceType", keys.get("service-type")) execution.setVariable("GENGS_siResourceLink", uri.build().toString()) diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java index 518fcf59d5..a5d8f12e83 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java @@ -32,7 +32,7 @@ import org.onap.aai.domain.yang.Customer; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.InstanceGroup; import org.onap.aai.domain.yang.L3Network; -import org.onap.aai.domain.yang.LinesOfBusiness; +import org.onap.aai.domain.yang.LineOfBusiness; import org.onap.aai.domain.yang.ModelVer; import org.onap.aai.domain.yang.NetworkPolicy; import org.onap.aai.domain.yang.OperationalEnvironment; @@ -47,9 +47,9 @@ import org.onap.aai.domain.yang.ServiceInstance; import org.onap.aai.domain.yang.ServiceSubscription; import org.onap.aai.domain.yang.Tenant; import org.onap.aai.domain.yang.TunnelXconnect; +import org.onap.aai.domain.yang.Vce; import org.onap.aai.domain.yang.VfModule; import org.onap.aai.domain.yang.VlanTag; -import org.onap.aai.domain.yang.Vce; import org.onap.aai.domain.yang.Vnfc; import org.onap.aai.domain.yang.VolumeGroup; import org.onap.aai.domain.yang.VpnBinding; @@ -80,7 +80,7 @@ public enum AAIObjectType implements GraphInventoryObjectType { SERVICE_SUBSCRIPTION(AAIObjectType.CUSTOMER.uriTemplate(), ServiceSubscription.class), SERVICE_INSTANCE(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), ServiceInstance.class), PROJECT(AAINamespaceConstants.BUSINESS, Project.class), - LINE_OF_BUSINESS(AAINamespaceConstants.BUSINESS, LinesOfBusiness.class), + LINE_OF_BUSINESS(AAINamespaceConstants.BUSINESS, LineOfBusiness.class), PLATFORM(AAINamespaceConstants.BUSINESS, Platform.class), OWNING_ENTITY(AAINamespaceConstants.BUSINESS, OwningEntity.class), ALLOTTED_RESOURCE(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), AllottedResource.class), |