From dc22a628fed70b82d074c509ebd91d51c33e20ec Mon Sep 17 00:00:00 2001 From: "waqas.ikram" Date: Thu, 24 Sep 2020 12:47:22 +0100 Subject: Fix getJob status bug Change-Id: I1a3bab4de5c6cfaa5b7874bccff79fbf72f8dc03 Issue-ID: SO-3268 Signed-off-by: waqas.ikram --- .../nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiServiceProviderImpl.java | 4 +++- .../so/etsi/nfvo/ns/lcm/bpmn/flows/service/JobExecutorService.java | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src') diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiServiceProviderImpl.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiServiceProviderImpl.java index 78cdc797bc..0da53a09c2 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiServiceProviderImpl.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiServiceProviderImpl.java @@ -22,6 +22,7 @@ package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.aai; import java.util.Optional; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.ServiceInstance; +import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; @@ -88,7 +89,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider { @Override public void deleteGenericVnf(final String vnfId) { logger.info("Deleting GenericVnf with id: {} from AAI.", vnfId); - final AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + final AAIResourceUri aaiResourceUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)); aaiClientProvider.getAaiClient().delete(aaiResourceUri); } } diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/JobExecutorService.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/JobExecutorService.java index f240fa33ef..31e3011c0e 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/JobExecutorService.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/JobExecutorService.java @@ -289,7 +289,7 @@ public class JobExecutorService { JobStatusEnum currentJobStatus = null; while (timeOutTime > System.currentTimeMillis()) { - final Optional optional = databaseServiceProvider.getJob(jobId); + final Optional optional = databaseServiceProvider.getRefreshedJob(jobId); if (optional.isEmpty()) { logger.error("Unable to find Job using jobId: {}", jobId); @@ -299,7 +299,7 @@ public class JobExecutorService { final NfvoJob nfvoJob = optional.get(); currentJobStatus = nfvoJob.getStatus(); logger.debug("Received job status response: \n {}", nfvoJob); - if (jobFinishedStates.contains(nfvoJob.getStatus())) { + if (jobFinishedStates.contains(currentJobStatus)) { logger.info("Job finished \n {}", currentJobStatus); return ImmutablePair.of(nfvoJob.getProcessInstanceId(), currentJobStatus); } -- cgit 1.2.3-korg