diff options
Diffstat (limited to 'adapters/mso-openstack-adapters/src/main/java/org/onap')
3 files changed, 17 insertions, 5 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java index 38b00688a7..aace75ff99 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java @@ -60,7 +60,7 @@ public class AuditStackService { auth); ExternalTaskClient client = ExternalTaskClient.create() .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(5).addInterceptor(interceptor) - .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(0, 0, 0)).build(); + .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(5000, 2, 30000)).build(); client.subscribe("InventoryAudit").lockDuration(5000) .handler(auditStack::executeExternalTask).open(); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackServiceData.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackServiceData.java index b0369395ed..ffbe1b4c46 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackServiceData.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackServiceData.java @@ -24,9 +24,11 @@ import java.util.Collections; import org.camunda.bpm.client.task.ExternalTask; import org.camunda.bpm.client.task.ExternalTaskService; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.audit.beans.AuditInventory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @@ -49,6 +51,7 @@ public class AuditStackServiceData { protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService){ AuditInventory auditInventory = externalTask.getVariable("auditInventory"); + setupMDC(externalTask); boolean success = false; try { logger.info("Executing External Task Audit Inventory, Retry Number: {} \n {}", auditInventory,externalTask.getRetries()); @@ -78,6 +81,11 @@ public class AuditStackServiceData { } + private void setupMDC(ExternalTask externalTask) { + String msoRequestId = (String)externalTask.getVariable("mso-request-id"); + if(msoRequestId != null && !msoRequestId.isEmpty()) + MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId); + } protected long calculateRetryDelay(int currentRetries){ int retrySequence = RETRY_SEQUENCE.length - currentRetries; long retryMultiplier = Long.parseLong(env.getProperty("mso.workflow.topics.retryMultiplier","6000")); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java index dfe5912fbf..da833c7b07 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java @@ -65,10 +65,14 @@ public class HeatStackAudit { .filter(p -> "OS::Nova::Server".equals(p.getType())).collect(Collectors.toList()); List<Resource> resourceGroups = resources.getList().stream() .filter(p -> "OS::Heat::ResourceGroup".equals(p.getType()) && p.getName().contains("subinterfaces")).collect(Collectors.toList()); - Set<Vserver> vserversToAudit = createVserverSet(resources, novaResources); - Set<Vserver> vserversWithSubInterfaces = processSubInterfaces(cloudRegion, tenantId, resourceGroups, - vserversToAudit); - return auditVservers.auditVservers(vserversWithSubInterfaces, tenantId, cloudOwner, cloudRegion); + if(novaResources.isEmpty()) + return true; + else{ + Set<Vserver> vserversToAudit = createVserverSet(resources, novaResources); + Set<Vserver> vserversWithSubInterfaces = processSubInterfaces(cloudRegion, tenantId, resourceGroups, + vserversToAudit); + return auditVservers.auditVservers(vserversWithSubInterfaces, tenantId, cloudOwner, cloudRegion); + } } catch (Exception e) { logger.error("Error during auditing stack resources", e); return false; |