From 88953d4f6c0ae360e6fb5d6967fc71dcc3652b4a Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Wed, 13 Mar 2019 15:43:33 -0400 Subject: Added param requestId to query 1 row Added param requestId to uniquely query 1 row from model distribution status db. Change-Id: Ice8db174166e6a00d211f191dcf5537eef729127 Issue-ID: SO-1651 Signed-off-by: Benjamin, Max (mb388a) --- .../tenantisolation/helpers/SDCClientHelper.java | 2 -- .../ActivateVnfStatusOperationalEnvironment.java | 25 ++++++++++++---------- 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap') diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java index 31c65e1bd2..9303e12071 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java @@ -82,7 +82,6 @@ public class SDCClientHelper { try { String urlString = this.buildUriBuilder(serviceModelVersionId, operationalEnvironmentId); - logger.debug("Url ASDC Activate request: {}", urlString); String jsonPayload = this.buildJsonWorkloadContext(workloadContext); String basicAuthCred = getBasicAuth(); @@ -158,7 +157,6 @@ public class SDCClientHelper { enhancedAsdcResponseJsonObj.put("statusCode", Integer.toString(statusCode)); enhancedAsdcResponseJsonObj.put("messageId", ""); enhancedAsdcResponseJsonObj.put("message", "Success"); - logger.debug("Url ASDC Activate response: {} {}", "distributionId ", sdcResponseJsonObj.get("distributionId")); } else { // error if (sdcResponseJsonObj.has("requestError") ) { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java index 219a2efcac..352bf8fb0b 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java @@ -86,26 +86,31 @@ public class ActivateVnfStatusOperationalEnvironment { */ public void execute(String requestId, CloudOrchestrationRequest request) throws ApiException { - - String operationalEnvironmentId = ""; + try { + + String operationalEnvironmentId = ""; String sdcDistributionId = request.getDistributionId(); Distribution sdcStatus = request.getDistribution(); - // Distribution, Query for operationalEnvironmentId, serviceModelVersionId + // Distribution, Query for operationalEnvironmentId, serviceModelVersionId, origRequestId this.queryDistributionDbResponse = client.getDistributionStatusById(sdcDistributionId); operationalEnvironmentId = this.queryDistributionDbResponse.getOperationalEnvId(); + this.origRequestId = this.queryDistributionDbResponse.getRequestId(); - // ServiceModel, Query for dbRequestId, recoveryAction, retryCountString - this.queryServiceModelResponse = client.findOneByOperationalEnvIdAndServiceModelVersionId(operationalEnvironmentId, queryDistributionDbResponse.getServiceModelVersionId()); - this.origRequestId = this.queryServiceModelResponse.getRequestId(); - + // ServiceModel, Query for recoveryAction, retryCountString + this.queryServiceModelResponse = client.findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId(operationalEnvironmentId, queryDistributionDbResponse.getServiceModelVersionId(), this.origRequestId); + processActivateSDCStatus(sdcDistributionId, sdcStatus, this.queryDistributionDbResponse, this.queryServiceModelResponse); // After EVERY status processed, need to query the status of all service modelId // to determine the OVERALL status if "COMPLETE" or "FAILURE": checkOrUpdateOverallStatus(operationalEnvironmentId, this.origRequestId); - + + } catch(Exception e) { + requestDb.updateInfraFailureCompletion(e.getMessage(), this.origRequestId, this.queryDistributionDbResponse.getOperationalEnvId()); + } + } /** @@ -161,13 +166,11 @@ public class ActivateVnfStatusOperationalEnvironment { } sdcStatusValue = modifiedStatus; - // should update 1 row, modified status & retryCount set 0 OperationalEnvServiceModelStatus updateRetryCountZeroAndStatus = dbHelper.updateRetryCountAndStatusInOperationalEnvServiceModelStatus(queryServiceModelResponse, modifiedStatus, - RETRY_COUNT_ZERO); + RETRY_COUNT_ZERO); client.save(updateRetryCountZeroAndStatus); - // should update 1 row, modified status OperationalEnvDistributionStatus updateDistStatus = dbHelper.updateStatusInOperationalEnvDistributionStatus(queryDistributionDbResponse, modifiedStatus, -- cgit 1.2.3-korg