diff options
7 files changed, 41 insertions, 30 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java index d6f2c6dbcc..c202170235 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java @@ -197,7 +197,8 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest { assertNotNull(vnfResourceCustomization.getVnfResources()); assertNotNull(vnfResourceCustomization.getVfModuleCustomizations()); assertEquals("vSAMP10a", vnfResourceCustomization.getVnfResources().getModelName()); - assertTrue("skip post instantiation configuration", vnfResourceCustomization.isSkipPostInstConf()); + assertTrue("skip post instantiation configuration", + vnfResourceCustomization.isSkipPostInstConf().booleanValue()); } @Test diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java index 14d0b0afc4..0dd7635506 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java @@ -70,9 +70,7 @@ public class CreateAAIInventory { List<String> oobMgtNetNames = new ArrayList<>(); - HeatBridgeApi heatBridgeClient = new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity, - cloudInformation.getOwner(), cloudInformation.getRegionId(), cloudSite.getRegionId(), - cloudInformation.getTenantId(), cloudInformation.getNodeType()); + HeatBridgeApi heatBridgeClient = createClient(getAaiClient(), cloudSite, cloudIdentity, cloudInformation); heatBridgeClient.authenticate(); @@ -128,6 +126,12 @@ public class CreateAAIInventory { heatBridgeClient.submitToAai(env.getProperty("heatBridgeDryrun", Boolean.class, false)); } + public HeatBridgeApi createClient(AAIResourcesClient client, CloudSite cloudSite, CloudIdentity cloudIdentity, + CloudInformation cloudInformation) { + return new HeatBridgeImpl(client, cloudIdentity, cloudInformation.getOwner(), cloudInformation.getRegionId(), + cloudSite.getRegionId(), cloudInformation.getTenantId(), cloudInformation.getNodeType()); + } + protected AAIResourcesClient getAaiClient() { if (aaiClient == null) return new AAIResourcesClient(); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/DeleteAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/DeleteAAIInventory.java index f904788de3..f9bbf4a75d 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/DeleteAAIInventory.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/DeleteAAIInventory.java @@ -59,13 +59,17 @@ public class DeleteAAIInventory { return; } CloudIdentity cloudIdentity = cloudSite.getIdentityService(); - HeatBridgeApi heatBridgeClient = new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity, - cloudInformation.getOwner(), cloudInformation.getRegionId(), cloudSite.getRegionId(), - cloudInformation.getTenantId(), cloudInformation.getNodeType()); + HeatBridgeApi heatBridgeClient = createClient(getAaiClient(), cloudSite, cloudIdentity, cloudInformation); heatBridgeClient.authenticate(); heatBridgeClient.deleteVfModuleData(cloudInformation.getVnfId(), cloudInformation.getVfModuleId()); } + public HeatBridgeApi createClient(AAIResourcesClient client, CloudSite cloudSite, CloudIdentity cloudIdentity, + CloudInformation cloudInformation) { + return new HeatBridgeImpl(client, cloudIdentity, cloudInformation.getOwner(), cloudInformation.getRegionId(), + cloudSite.getRegionId(), cloudInformation.getTenantId(), cloudInformation.getNodeType()); + } + protected AAIResourcesClient getAaiClient() { if (aaiClient == null) return new AAIResourcesClient(); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java index 9b20139969..0512912b9f 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java @@ -61,9 +61,8 @@ import org.onap.aai.domain.yang.Pserver; import org.onap.aai.domain.yang.Relationship; import org.onap.aai.domain.yang.RelationshipList; import org.onap.aai.domain.yang.SriovPf; -import org.onap.aai.domain.yang.Subnets; import org.onap.aai.domain.yang.SriovVf; -import org.onap.aai.domain.yang.VfModule; +import org.onap.aai.domain.yang.Subnets; import org.onap.aai.domain.yang.Vlan; import org.onap.aai.domain.yang.Vserver; import org.onap.aaiclient.client.aai.AAIDSLQueryClient; @@ -734,27 +733,15 @@ public class HeatBridgeImpl implements HeatBridgeApi { Objects.requireNonNull(vnfId, "Null vnf-id!"); Objects.requireNonNull(vfModuleId, "Null vf-module-id!"); try { - Optional<VfModule> vfModule = resourcesClient.get(AAIUriFactory + AAIResultWrapper vfModule = resourcesClient.get(AAIUriFactory .createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)) - .depth(Depth.ONE), NotFoundException.class).asBean(VfModule.class); + .depth(Depth.ONE), NotFoundException.class); - AAIResultWrapper resultWrapper = new AAIResultWrapper(vfModule.get()); - Optional<Relationships> relationships = resultWrapper.getRelationships(); + Optional<Relationships> relationships = vfModule.getRelationships(); logger.debug("VfModule contains relationships in AAI: {}", relationships.isPresent()); if (relationships.isPresent()) { - List<AAIResourceUri> l3NetworkUris = relationships.get().getRelatedUris(Types.L3_NETWORK); - logger.debug("L3Network contains {} relationships in AAI", l3NetworkUris.size()); - - if (!l3NetworkUris.isEmpty()) { - for (AAIResourceUri l3NetworkUri : l3NetworkUris) { - if (env.getProperty("heatBridgeDryrun", Boolean.class, true)) { - logger.debug("Would delete L3Network: {}", l3NetworkUri.build().toString()); - } else { - resourcesClient.delete(l3NetworkUri); - } - } - } + deleteL3Networks(relationships.get()); List<AAIResourceUri> vserverUris = relationships.get().getRelatedUris(Types.VSERVER); logger.debug("VServer contains {} relationships in AAI", vserverUris.size()); @@ -782,6 +769,21 @@ public class HeatBridgeImpl implements HeatBridgeApi { } } + protected void deleteL3Networks(Relationships relationships) { + List<AAIResourceUri> l3NetworkUris = relationships.getRelatedUris(Types.L3_NETWORK); + logger.debug("L3Network contains {} relationships in AAI", l3NetworkUris.size()); + + if (!l3NetworkUris.isEmpty()) { + for (AAIResourceUri l3NetworkUri : l3NetworkUris) { + if (env.getProperty("heatBridgeDryrun", Boolean.class, true)) { + logger.debug("Would delete L3Network: {}", l3NetworkUri.build().toString()); + } else { + resourcesClient.delete(l3NetworkUri); + } + } + } + } + private void createTransactionToDeleteSriovPfFromPserver(List<AAIResourceUri> vserverUris) { Map<String, List<String>> pserverToPciIdMap = getPserverToPciIdMap(vserverUris); for (Map.Entry<String, List<String>> entry : pserverToPciIdMap.entrySet()) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java index 2119ced951..564ee91fb2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java @@ -84,7 +84,7 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator { VnfResourceCustomization vrc = catalogDbClient.findVnfResourceCustomizationInList(customizationUUID, vnfResourceCustomizations); if (null != vrc) { - boolean skipConfigVNF = vrc.isSkipPostInstConf(); + boolean skipConfigVNF = vrc.isSkipPostInstConf().booleanValue(); currentSequenceSkipCheck(execution, skipConfigVNF); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java index 6589ae77f5..83f61e3a4f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java @@ -34,7 +34,7 @@ public class SkipConfigVnfListener implements FlowManipulator { if (vnfResourceCustomizations != null && !vnfResourceCustomizations.isEmpty()) { VnfResourceCustomization vrc = catalogDbClient.findVnfResourceCustomizationInList(vnfCustomizationUUID, vnfResourceCustomizations); - boolean skipConfigVNF = vrc.isSkipPostInstConf(); + boolean skipConfigVNF = vrc.isSkipPostInstConf().booleanValue(); if (skipConfigVNF) { execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, ((int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE)) + 1); diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java index 3e7995417d..1b1df2117e 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java @@ -118,7 +118,7 @@ public class VnfResourceCustomization implements Serializable { private String blueprintVersion; @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION") - private boolean skipPostInstConf; + private Boolean skipPostInstConf = true; @Column(name = "VNFCINSTANCEGROUP_ORDER") private String vnfcInstanceGroupOrder; @@ -327,11 +327,11 @@ public class VnfResourceCustomization implements Serializable { this.blueprintVersion = blueprintVersion; } - public boolean isSkipPostInstConf() { + public Boolean isSkipPostInstConf() { return skipPostInstConf; } - public void setSkipPostInstConf(boolean skipPostInstConf) { + public void setSkipPostInstConf(Boolean skipPostInstConf) { this.skipPostInstConf = skipPostInstConf; } |