diff options
Diffstat (limited to 'adapters')
10 files changed, 68 insertions, 46 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java index a7c47f8f53..c4ef3678c3 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java @@ -363,7 +363,8 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin { if (latestStack == null && notFoundIsSuccess) { return null; } else if (latestStack != null) { - statusHandler.updateStackStatus(latestStack); + String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID); + statusHandler.updateStackStatus(latestStack, requestId); if (stackStatus.equals(latestStack.getStackStatus())) { if (LocalDateTime.now().isAfter(stopPolling)) { logger.error("Polling of stack timed out with Status: {}", latestStack.getStackStatus()); diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java index b875c2c8bb..c8fae84479 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java @@ -6,6 +6,8 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ + * Modifications Copyright (c) 2020 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 @@ -26,7 +28,6 @@ package org.onap.so.openstack.utils; import java.util.HashMap; import java.util.Map; import java.util.Optional; -import org.onap.so.cloud.authentication.AuthenticationMethodFactory; import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.logging.filter.base.ErrorCode; @@ -39,7 +40,6 @@ import org.onap.so.openstack.exceptions.MsoOpenstackException; import org.onap.so.openstack.exceptions.MsoTenantAlreadyExists; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.woorea.openstack.base.client.OpenStackBaseException; import com.woorea.openstack.base.client.OpenStackConnectException; @@ -59,19 +59,7 @@ import com.woorea.openstack.keystone.utils.KeystoneUtils; public class MsoKeystoneUtils extends MsoTenantUtils { public static final String DELETE_TENANT = "Delete Tenant"; - private static Logger logger = LoggerFactory.getLogger(MsoKeystoneUtils.class); - - @Autowired - private AuthenticationMethodFactory authenticationMethodFactory; - - @Autowired - private MsoHeatUtils msoHeatUtils; - - @Autowired - private MsoNeutronUtils msoNeutronUtils; - - @Autowired - private MsoTenantUtilsFactory tenantUtilsFactory; + private static final Logger LOGGER = LoggerFactory.getLogger(MsoKeystoneUtils.class); /** * Create a tenant with the specified name in the given cloud. If the tenant already exists, an Exception will be @@ -94,7 +82,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { // Obtain the cloud site information where we will create the tenant Optional<CloudSite> cloudSiteOpt = cloudConfig.getCloudSite(cloudSiteId); if (!cloudSiteOpt.isPresent()) { - logger.error("{} MSOCloudSite {} not found {} ", MessageEnum.RA_CREATE_TENANT_ERR, cloudSiteId, + LOGGER.error("{} MSOCloudSite {} not found {} ", MessageEnum.RA_CREATE_TENANT_ERR, cloudSiteId, ErrorCode.DataError.getValue()); throw new MsoCloudSiteNotFound(cloudSiteId); } @@ -106,7 +94,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { if (tenant != null) { // Tenant already exists. Throw an exception - logger.error("{} Tenant name {} already exists on Cloud site id {}, {}", + LOGGER.error("{} Tenant name {} already exists on Cloud site id {}, {}", MessageEnum.RA_TENANT_ALREADY_EXIST, tenantName, cloudSiteId, ErrorCode.DataError.getValue()); throw new MsoTenantAlreadyExists(tenantName, cloudSiteId); } @@ -153,7 +141,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { // Failed to attach MSO User to the new tenant. Can't operate without access, // so roll back the tenant. if (!backout) { - logger.warn("{} Create Tenant errored, Tenant deletion suppressed {} ", + LOGGER.warn("{} Create Tenant errored, Tenant deletion suppressed {} ", MessageEnum.RA_CREATE_TENANT_ERR, ErrorCode.DataError.getValue()); } else { try { @@ -161,7 +149,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { executeAndRecordOpenstackRequest(request); } catch (Exception e2) { // Just log this one. We will report the original exception. - logger.error("{} Nested exception rolling back tenant {} ", MessageEnum.RA_CREATE_TENANT_ERR, + LOGGER.error("{} Nested exception rolling back tenant {} ", MessageEnum.RA_CREATE_TENANT_ERR, ErrorCode.DataError.getValue(), e2); } } @@ -295,14 +283,14 @@ public class MsoKeystoneUtils extends MsoTenantUtils { // Check that the tenant exists. Also, need the ID to delete Tenant tenant = findTenantById(keystoneAdminClient, tenantId); if (tenant == null) { - logger.error("{} Tenant id {} not found on cloud site id {}, {}", MessageEnum.RA_TENANT_NOT_FOUND, + LOGGER.error("{} Tenant id {} not found on cloud site id {}, {}", MessageEnum.RA_TENANT_NOT_FOUND, tenantId, cloudSiteId, ErrorCode.DataError.getValue()); return false; } OpenStackRequest<Void> request = keystoneAdminClient.tenants().delete(tenant.getId()); executeAndRecordOpenstackRequest(request); - logger.debug("Deleted Tenant {} ({})", tenant.getId(), tenant.getName()); + LOGGER.debug("Deleted Tenant {} ({})", tenant.getId(), tenant.getName()); } catch (OpenStackBaseException e) { // Convert Keystone OpenStackResponseException to MsoOpenstackException throw keystoneErrorToMsoException(e, DELETE_TENANT); @@ -341,7 +329,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { Tenant tenant = findTenantByName(keystoneAdminClient, tenantName); if (tenant == null) { // OK if tenant already doesn't exist. - logger.error("{} Tenant {} not found on Cloud site id {}, {}", MessageEnum.RA_TENANT_NOT_FOUND, + LOGGER.error("{} Tenant {} not found on Cloud site id {}, {}", MessageEnum.RA_TENANT_NOT_FOUND, tenantName, cloudSiteId, ErrorCode.DataError.getValue()); return false; } @@ -350,7 +338,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { OpenStackRequest<Void> request = keystoneAdminClient.tenants().delete(tenant.getId()); executeAndRecordOpenstackRequest(request); - logger.debug("Deleted Tenant {} ({})", tenant.getId(), tenant.getName()); + LOGGER.debug("Deleted Tenant {} ({})", tenant.getId(), tenant.getName()); } catch (OpenStackBaseException e) { // Note: It doesn't seem to matter if tenant doesn't exist, no exception is thrown. @@ -419,7 +407,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { } catch (RuntimeException e) { String error = "Identity service not found: region=" + region + ",cloud=" + cloudIdentity.getId(); - logger.error("{} Region: {} Cloud identity {} {} Exception in findEndpointURL ", + LOGGER.error("{} Region: {} Cloud identity {} {} Exception in findEndpointURL ", MessageEnum.IDENTITY_SERVICE_NOT_FOUND, region, cloudIdentity.getId(), ErrorCode.DataError.getValue(), e); throw new MsoAdapterException(error, e); @@ -476,7 +464,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { if (e.getStatus() == 404) { return null; } else { - logger.error("{} {} Openstack Error, GET Tenant by Id ({}): ", MessageEnum.RA_CONNECTION_EXCEPTION, + LOGGER.error("{} {} Openstack Error, GET Tenant by Id ({}): ", MessageEnum.RA_CONNECTION_EXCEPTION, ErrorCode.DataError.getValue(), tenantId, e); throw e; } @@ -505,7 +493,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { if (e.getStatus() == 404) { return null; } else { - logger.error("{} {} Openstack Error, GET Tenant By Name ({}) ", MessageEnum.RA_CONNECTION_EXCEPTION, + LOGGER.error("{} {} Openstack Error, GET Tenant By Name ({}) ", MessageEnum.RA_CONNECTION_EXCEPTION, ErrorCode.DataError.getValue(), tenantName, e); throw e; } @@ -534,7 +522,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { // Not found by ID. Search for name return findUserByName(adminClient, userNameOrId); } else { - logger.error("{} {} Openstack Error, GET User ({}) ", MessageEnum.RA_CONNECTION_EXCEPTION, + LOGGER.error("{} {} Openstack Error, GET User ({}) ", MessageEnum.RA_CONNECTION_EXCEPTION, ErrorCode.DataError.getValue(), userNameOrId, e); throw e; } @@ -562,7 +550,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { if (e.getStatus() == 404) { return null; } else { - logger.error("{} {} Openstack Error, GET User By Name ({}): ", MessageEnum.RA_CONNECTION_EXCEPTION, + LOGGER.error("{} {} Openstack Error, GET User By Name ({}): ", MessageEnum.RA_CONNECTION_EXCEPTION, ErrorCode.DataError.getValue(), userName, e); throw e; } diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackStatusHandler.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackStatusHandler.java index bf29c39f99..8f1543e561 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackStatusHandler.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackStatusHandler.java @@ -43,9 +43,8 @@ public class StackStatusHandler { private RequestsDbClient requestDBClient; @Async - public void updateStackStatus(Stack stack) { + public void updateStackStatus(Stack stack, String requestId) { try { - String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID); String stackStatus = mapper.writeValueAsString(stack); RequestProcessingData requestProcessingData = requestDBClient.getRequestProcessingDataBySoRequestIdAndNameAndGrouping(requestId, diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java index 4f7fed7df4..5bd7c29313 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java @@ -36,7 +36,6 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -46,6 +45,7 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.db.request.beans.CloudApiRequests; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; @@ -53,6 +53,7 @@ import org.onap.so.openstack.beans.CreateStackRequest; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.exceptions.MsoOpenstackException; import org.onap.so.openstack.exceptions.MsoStackAlreadyExists; +import org.slf4j.MDC; import org.springframework.core.env.Environment; import com.fasterxml.jackson.databind.ObjectMapper; import com.woorea.openstack.base.client.OpenStackResponseException; @@ -63,6 +64,7 @@ import com.woorea.openstack.heat.StackResource.DeleteStack; import com.woorea.openstack.heat.model.CreateStackParam; import com.woorea.openstack.heat.model.Resources; import com.woorea.openstack.heat.model.Stack; +import java.util.UUID; @RunWith(MockitoJUnitRunner.class) public class MsoHeatUtilsTest extends MsoHeatUtils { @@ -104,9 +106,15 @@ public class MsoHeatUtilsTest extends MsoHeatUtils { private String cloudSiteId = "cloudSiteId"; private String tenantId = "tenantId"; + private String getRequestId() { + return MDC.get(ONAPLogConstants.MDCs.REQUEST_ID); + } + @Before public void setup() { doReturn("15").when(env).getProperty("org.onap.so.adapters.po.pollInterval", "15"); + String requestId = UUID.randomUUID().toString(); + MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId); } @Test @@ -117,6 +125,7 @@ public class MsoHeatUtilsTest extends MsoHeatUtils { stack.setStackStatus("CREATE_IN_PROGRESS"); stack.setStackStatusReason("Stack Finished"); + String requestId = getRequestId(); Stack latestStack = new Stack(); latestStack.setId("id"); latestStack.setStackName("stackName"); @@ -125,7 +134,7 @@ public class MsoHeatUtilsTest extends MsoHeatUtils { doReturn(latestStack).when(heatUtils).queryHeatStack(isA(Heat.class), eq("stackName/id")); doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId); Stack actual = heatUtils.pollStackForStatus(1, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId, false); - Mockito.verify(stackStatusHandler, times(1)).updateStackStatus(latestStack); + Mockito.verify(stackStatusHandler, times(1)).updateStackStatus(latestStack, requestId); Mockito.verify(heatUtils, times(1)).queryHeatStack(isA(Heat.class), eq("stackName/id")); assertEquals(true, actual != null); } @@ -137,12 +146,13 @@ public class MsoHeatUtilsTest extends MsoHeatUtils { stack.setStackName("stackName"); stack.setStackStatus("CREATE_IN_PROGRESS"); stack.setStackStatusReason("Stack Finished"); - doNothing().when(stackStatusHandler).updateStackStatus(stack); + String requestId = getRequestId(); + doNothing().when(stackStatusHandler).updateStackStatus(stack, requestId); doReturn(stack).when(heatUtils).queryHeatStack(isA(Heat.class), eq("stackName/id")); doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId); doReturn("61").when(env).getProperty("org.onap.so.adapters.po.pollInterval", "15"); Stack actual = heatUtils.pollStackForStatus(1, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId, false); - Mockito.verify(stackStatusHandler, times(1)).updateStackStatus(stack); + Mockito.verify(stackStatusHandler, times(1)).updateStackStatus(stack, requestId); Mockito.verify(heatUtils, times(1)).queryHeatStack(isA(Heat.class), eq("stackName/id")); assertEquals(true, actual != null); } @@ -154,11 +164,12 @@ public class MsoHeatUtilsTest extends MsoHeatUtils { stack.setStackName("stackName"); stack.setStackStatus("CREATE_IN_PROGRESS"); stack.setStackStatusReason("Stack Finished"); - doNothing().when(stackStatusHandler).updateStackStatus(stack); + String requestId = getRequestId(); + doNothing().when(stackStatusHandler).updateStackStatus(stack, requestId); doReturn(stack).when(heatUtils).queryHeatStack(isA(Heat.class), eq("stackName/id")); doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId); Stack actual = heatUtils.pollStackForStatus(1, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId, false); - Mockito.verify(stackStatusHandler, times(5)).updateStackStatus(stack); + Mockito.verify(stackStatusHandler, times(5)).updateStackStatus(stack, requestId); Mockito.verify(heatUtils, times(5)).queryHeatStack(isA(Heat.class), eq("stackName/id")); assertEquals(true, actual != null); } @@ -417,6 +428,7 @@ public class MsoHeatUtilsTest extends MsoHeatUtils { CreateStackParam createStackParam = new CreateStackParam(); createStackParam.setStackName("stackName"); + String requestId = getRequestId(); doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId); doReturn(stackResource).when(heatClient).getStacks(); doReturn(mockCreateStack).when(stackResource).create(createStackParam); @@ -425,7 +437,7 @@ public class MsoHeatUtilsTest extends MsoHeatUtils { heatUtils.createStack(createStackParam, cloudSiteId, tenantId); Mockito.verify(stackResource, times(1)).create(createStackParam); - Mockito.verify(heatUtils, times(1)).saveStackRequest(eq(createStackParam), isNull(), eq("stackName")); + Mockito.verify(heatUtils, times(1)).saveStackRequest(eq(createStackParam), eq(requestId), eq("stackName")); Mockito.verify(heatClient, times(1)).getStacks(); Mockito.verify(stackResource, times(1)).create(createStackParam); } diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/StackStatusHandlerTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/StackStatusHandlerTest.java index 985a39a76b..c210a8b6ad 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/StackStatusHandlerTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/StackStatusHandlerTest.java @@ -26,6 +26,7 @@ import static org.junit.Assert.assertNotNull; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; import java.io.IOException; +import java.util.UUID; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; @@ -47,35 +48,41 @@ public class StackStatusHandlerTest { @Mock RequestsDbClient requestDBClient; + private String getRequestId() { + return UUID.randomUUID().toString(); + } + @Test public final void recordExists_Test() throws MsoException, IOException { RequestProcessingData requestProcessingData = new RequestProcessingData(); requestProcessingData.setValue("testMe"); + String requestId = getRequestId(); doReturn(requestProcessingData).when(requestDBClient) - .getRequestProcessingDataBySoRequestIdAndNameAndGrouping(null, "stackName", "id"); + .getRequestProcessingDataBySoRequestIdAndNameAndGrouping(requestId, "stackName", "id"); Stack latestStack = new Stack(); latestStack.setId("id"); latestStack.setStackName("stackName"); latestStack.setStackStatus("CREATE_COMPLETE"); latestStack.setStackStatusReason("Stack Finished"); - statusHandler.updateStackStatus(latestStack); + statusHandler.updateStackStatus(latestStack, requestId); Mockito.verify(requestDBClient, times(1)).updateRequestProcessingData(requestProcessingData); assertNotEquals("testMe", requestProcessingData.getValue()); } @Test public final void record_Not_Exists_Test() throws MsoException, IOException { + String requestId = getRequestId(); ArgumentCaptor<RequestProcessingData> requestCaptor = ArgumentCaptor.forClass(RequestProcessingData.class); - doReturn(null).when(requestDBClient).getRequestProcessingDataBySoRequestIdAndNameAndGrouping(null, "stackName", - "id"); + doReturn(null).when(requestDBClient).getRequestProcessingDataBySoRequestIdAndNameAndGrouping(requestId, + "stackName", "id"); Stack latestStack = new Stack(); latestStack.setId("id"); latestStack.setStackName("stackName"); latestStack.setStackStatus("CREATE_COMPLETE"); latestStack.setStackStatusReason("Stack Finished"); - statusHandler.updateStackStatus(latestStack); + statusHandler.updateStackStatus(latestStack, requestId); Mockito.verify(requestDBClient, times(1)).saveRequestProcessingData(requestCaptor.capture()); RequestProcessingData actualRequest = requestCaptor.getValue(); assertEquals("id", actualRequest.getGroupingId()); diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.8__AddSoftwareVersionToPnfCustomization.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.8__AddSoftwareVersionToPnfCustomization.sql new file mode 100644 index 0000000000..5578d3e590 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.8__AddSoftwareVersionToPnfCustomization.sql @@ -0,0 +1,6 @@ +use catalogdb; + +ALTER TABLE pnf_resource_customization +ADD DEFAULT_SOFTWARE_VERSION varchar(4000) null; + + diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java index 7ec6c0f9e1..96f2956b93 100644 --- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java +++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java @@ -99,7 +99,8 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager { restUtil.createServiceInstance(nssiInstance, serviceInfo); } else if (ActionType.DEALLOCATE.equals(jobOperType)) { - restUtil.deleteServiceInstance(serviceInfo); + // TODO + // restUtil.deleteServiceInstance(serviceInfo); } } } diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java index 3d0d0926fd..20ad3d10b7 100644 --- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java +++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java @@ -93,7 +93,7 @@ public class ExternalAnNssmfManager extends ExternalNssmfManager { status.setResourceInstanceID(nssiId); status.setOperType(actionType.toString()); - updateDbStatus(status, restResponse.getStatus(), JobStatus.FINISHED, + updateDbStatus(status, restResponse.getStatus(), JobStatus.STARTED, NssmfAdapterUtil.getStatusDesc(actionType)); } // todo 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 f5a6355529..f904788de3 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 @@ -48,10 +48,16 @@ public class DeleteAAIInventory { @Autowired protected Environment env; + private static final String MULTICLOUD_MODE = "MULTICLOUD"; + public void heatbridge(CloudInformation cloudInformation) throws MsoCloudSiteNotFound, HeatBridgeException { logger.debug("Heatbridge delete executing"); CloudSite cloudSite = cloudConfig.getCloudSite(cloudInformation.getRegionId()) .orElseThrow(() -> new MsoCloudSiteNotFound(cloudInformation.getRegionId())); + if (cloudSite.getOrchestrator() != null && MULTICLOUD_MODE.equalsIgnoreCase(cloudSite.getOrchestrator())) { + logger.debug("Skipping Heatbridge as CloudSite orchestrator is: " + MULTICLOUD_MODE); + return; + } CloudIdentity cloudIdentity = cloudSite.getIdentityService(); HeatBridgeApi heatBridgeClient = new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity, cloudInformation.getOwner(), cloudInformation.getRegionId(), cloudSite.getRegionId(), diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java index 6b979833eb..58c43be36a 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java @@ -1120,7 +1120,9 @@ public class MsoVnfPluginAdapterImpl { long subStartTime = System.currentTimeMillis(); try { // TODO: Get an appropriate timeout value - require access to the model - vduPlugin.deleteVdu(cloudInfo, vfModuleId, 5); + if (!vduInstance.getStatus().getState().equals(VduStateType.NOTFOUND)) { + vduPlugin.deleteVdu(cloudInfo, vfModuleId, 5); + } } catch (VduException me) { me.addContext("DeleteVfModule"); // Convert to a generic VnfException |