summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-10-22 14:51:51 +0000
committerGerrit Code Review <gerrit@onap.org>2017-10-22 14:51:51 +0000
commit7768e0f25fd40fc637cefb9888d1f8dffdf6e4f1 (patch)
tree896d38ac3bcb97d067a81badae4ecc3fde05d77d
parente13ec4b4c2feaffb81d8cbcab435617a99d9739e (diff)
parentdf70481f6f5ba964598618707b5f961c9852330f (diff)
Merge "Fix issues in resubmit"
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java89
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java2
2 files changed, 67 insertions, 24 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
index 4167785c02..9e4d3bf51b 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
@@ -405,58 +405,101 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
List<VersionedVendorSoftwareProductInfo> vspList = Objects.requireNonNull(
vendorSoftwareProductManager.listVsps(VersionStatus.Final.name(), user));
+ int skippedCounter = 0;
+ final int vspListSizeBefore = vspList.size();
+
+ for (VersionedVendorSoftwareProductInfo versionVspInfo : vspList) {
+ final VspDetails vspDetails = versionVspInfo.getVspDetails();
+ final String vspId = vspDetails.getId();
+ final Version latestFinalVersion =
+ getVersionInfo(vspId, VersionableEntityAction.Read, user).getLatestFinalVersion();
+
+ if (latestFinalVersion.getStatus().equals(VersionStatus.Locked)) {
+ logger.info("Skipping processing VSP name [{}]/id [{}] due to status LOCKED", vspDetails
+ .getName(),
+ vspId);
+ skippedCounter++;
+ vspList.remove(versionVspInfo);
+ }
+ }
+
+ logger.info("Removed {} VSPs out of {} from processing due to status LOCKED", skippedCounter,
+ vspListSizeBefore);
int healingCounter = 0;
int failedCounter = 0;
+ int totalCounter = 0;
- try {
- logger.info("Total number of VSPs: {}. Performing healing and " +
- "resubmit for all non-Manual VSPs in submitted status.\n No need to pre-set oldVersion " +
- "field", vspList.size());
-
- for (VersionedVendorSoftwareProductInfo versionVspInfo : vspList) {
+ final int vspListSize = vspList.size();
+ logger.info("Total number of VSPs: {}. Performing healing and " +
+ "resubmit for all non-Manual VSPs in submitted status.\n No need to pre-set oldVersion " +
+ "field", vspListSize);
+ for (VersionedVendorSoftwareProductInfo versionVspInfo : vspList) {
+ try {
+ totalCounter++;
+ final Version activeVersion = versionVspInfo.getVersionInfo().getActiveVersion();
final VspDetails vspDetails = versionVspInfo.getVspDetails();
final String vspId = vspDetails.getId();
final Version latestFinalVersion =
getVersionInfo(vspId, VersionableEntityAction.Read, user).getLatestFinalVersion();
+ final String vspName = vspDetails.getName();
+ logger.info("VSP Name {}, VSP id [{}], Active Version {} , Active Version Status {}," +
+ "Latest Final Version {} , " +
+ "Latest Final Version Status {}", vspName, vspId, activeVersion
+ .toString(),
+ activeVersion.getStatus(), latestFinalVersion.toString(),
+ latestFinalVersion.getStatus());
+
if (Objects.nonNull(latestFinalVersion) &&
(!OnboardingMethod.Manual.name().equals(vspDetails.getOnboardingMethod()))) {
- reSubmit(vspDetails, user);
+ reSubmit(vspDetails, user, totalCounter, vspListSize);
healingCounter++;
}
+ } catch (Exception e) {
+ failedCounter++;
}
-
- } catch (Exception e) {
- logger.error("Failed during resubmitAll", e);
- failedCounter++;
- } finally {
- logger.info("Finished attempted healing and resubmit for {} VSPs out " +
- "of total # of {} submitted VSPs. Failure count during resubmitAll: {}",
- healingCounter, vspList.size(), failedCounter);
}
+ logger.info("Total VSPs processed {}. Completed running healing and resubmit for {} VSPs out" +
+ " " +
+ "of total # of {} submitted VSPs. Failures count during resubmitAll: {}",
+ totalCounter, healingCounter, vspListSize, failedCounter);
+
return Response.ok().build();
}
- private void reSubmit(VspDetails vspDetails, String user) throws IOException {
+ private void reSubmit(VspDetails vspDetails, String user, int currentCount, int total) throws
+ Exception {
final String vspId = vspDetails.getId();
- long startTime = System.currentTimeMillis();
- logger.info("Starting on healing and resubmit for VSP id[{}]", vspId);
+ final String vspName = vspDetails.getName();
+ final Version versionBefore = vspDetails.getVersion();
+ Version finalVersion;
+
+ logger.info("Starting on healing and resubmit for VSP [{}], #{} out of total {}", vspName,
+ currentCount, total);
vspDetails.setOldVersion("true");
- vendorSoftwareProductManager.healAndAdvanceFinalVersion(vspId, vspDetails, user);
+ try {
+ finalVersion =
+ vendorSoftwareProductManager.healAndAdvanceFinalVersion(vspId, vspDetails, user);
- long endTime = System.currentTimeMillis();
- long seconds = (endTime - startTime) / 1000;
+ } catch (Exception e) {
+
+ logger.error("Failed during resubmit, VSP [{}] , version before:{}, version after:{}, " +
+ "status after:{}, with exception:{}",
+ vspName, versionBefore.toString(), vspDetails.getVersion().toString(), vspDetails
+ .getVersion().getStatus().name(), e.getMessage());
+ throw e;
+ }
- logger.info("Completed healing and resubmit for VSP id [{}], duration: {} seconds",
- vspId, seconds);
+ logger.info("Completed healing and resubmit for VSP [{}], version before:{}, version after:" +
+ " {}", vspName, versionBefore.toString(), finalVersion);
}
private static void printAuditForErrors(List<ErrorMessage> errorList, String vspId,
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java
index 16f9c60d7f..1c895ffc6f 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java
@@ -92,7 +92,7 @@ public class HealingManagerImpl implements HealingManager {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.SELF_HEALING, ErrorLevel.ERROR.name(), LoggerErrorCode
.DATA_ERROR.getErrorCode(), LoggerErrorDescription.CANT_HEAL);
- healingFailureMessages.add(e.getMessage());
+ healingFailureMessages.add(e.getMessage() + " ,healer name :" + healerImplClassName);
}
return null;
}