From 032c4e3bffa6171e5ea0f7fd584d86cfc16ac31c Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Sat, 8 Sep 2018 16:04:51 -0400 Subject: stability fixes fixed bean error fixed execution variable name do not explicitly set hibernate objects Removed remaing references to tunnel-xconnect fixed virtual link case Change-Id: Ia5a59794e84beadcbf259efb899878cc4465ca57 Issue-ID: SO-997 Signed-off-by: Benjamin, Max (mb388a) --- .../servicedecomposition/tasks/BBInputSetup.java | 29 +++-- .../resources/subprocess/CompleteMsoProcess.bpmn | 3 +- .../org/onap/so/bpmn/mock/StubResponseAAI.java | 140 ++++++++++----------- .../tasks/BBInputSetupTest.java | 11 +- .../java/org/onap/so/bpmn/common/WorkflowTest.java | 2 +- .../bpmn/infrastructure/scripts/DoCreateVnf.groovy | 2 +- 6 files changed, 95 insertions(+), 92 deletions(-) (limited to 'bpmn') 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 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 @@ - + SequenceFlow_18 @@ -101,6 +101,7 @@ buildDataErrorMessage.buildDataError(execution, "Complete MSO -- Update DB stat + SequenceFlow_81 SequenceFlow_13qdn1s 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. @@ -43,16 +43,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 */ @@ -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 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()) -- cgit 1.2.3-korg