diff options
author | Sébastien Determe <sd378r@intl.att.com> | 2018-05-11 09:51:24 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-05-11 09:51:24 +0000 |
commit | 78e986b674f6ef6d3b94d5d62ddcd7a1f9071a8c (patch) | |
tree | f2c7cb76175f0792e4dc6d73ab4534160934dc10 | |
parent | 2dc6417f8f6fa7be8974115e042eeebb3c832269 (diff) | |
parent | 3271165f71b5aee7bc9b5186ee2566c8dd2f2626 (diff) |
Merge "Fix DCAE deploy/undeploy"
4 files changed, 24 insertions, 19 deletions
diff --git a/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java b/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java index 2ba910a6..0ca2850f 100644 --- a/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java +++ b/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java @@ -90,6 +90,22 @@ public class DcaeDispatcherServices { }
}
+ public String getOperationStatusWithRetry(String operationStatusUrl) throws InterruptedException {
+ String operationStatus = "";
+ for (int i = 0; i < Integer.valueOf(refProp.getStringValue("dcae.dispatcher.retry.limit")); i++) {
+ logger.info("Trying to get Operation status on DCAE for url:" + operationStatusUrl);
+ operationStatus = getOperationStatus(operationStatusUrl);
+ logger.info("Current Status is:" + operationStatus);
+ if (!"processing".equalsIgnoreCase(operationStatus)) {
+ return operationStatus;
+ } else {
+ Thread.sleep(Integer.valueOf(refProp.getStringValue("dcae.dispatcher.retry.interval")));
+ }
+ }
+ logger.warn("Number of attempts on DCAE is over, stopping the getOperationStatus method");
+ return operationStatus;
+ }
+
/**
* Get the Operation Status from a specified URL.
*
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java index 1b760670..592a9457 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java @@ -849,17 +849,7 @@ public class CldsService extends SecureServiceBase { } String createNewDeploymentStatusUrl = dcaeDispatcherServices.createNewDeployment(deploymentId, model.getTypeId(), modelProp.getGlobal().getDeployParameters()); - String operationStatus = "processing"; - long waitingTime = System.nanoTime() + DCAE_DEPLOY_WAITING_TIME; - while ("processing".equalsIgnoreCase(operationStatus)) { - if (waitingTime < System.nanoTime()) { - logger.info("Waiting is over for DCAE deployment"); - break; - } - logger.info("Waiting 5s before sending query to DCAE"); - Thread.sleep(5000); - operationStatus = dcaeDispatcherServices.getOperationStatus(createNewDeploymentStatusUrl); - } + String operationStatus = dcaeDispatcherServices.getOperationStatusWithRetry(createNewDeploymentStatusUrl); if ("succeeded".equalsIgnoreCase(operationStatus)) { String artifactName = model.getControlName(); if (artifactName != null) { @@ -904,14 +894,7 @@ public class CldsService extends SecureServiceBase { try { String operationStatusUndeployUrl = dcaeDispatcherServices.deleteExistingDeployment(model.getDeploymentId(), model.getTypeId()); - String operationStatus = "processing"; - long waitingTime = System.nanoTime() + TimeUnit.MINUTES.toNanos(10); - while ("processing".equalsIgnoreCase(operationStatus)) { - if (waitingTime < System.nanoTime()) { - break; - } - operationStatus = dcaeDispatcherServices.getOperationStatus(operationStatusUndeployUrl); - } + String operationStatus = dcaeDispatcherServices.getOperationStatusWithRetry(operationStatusUndeployUrl); if ("succeeded".equalsIgnoreCase(operationStatus)) { String artifactName = model.getControlName(); if (artifactName != null) { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index d9d69c71..17248182 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -201,6 +201,8 @@ clamp.config.dcae.intentory.retry.limit=3 #DCAE Dispatcher Url Properties
clamp.config.dcae.dispatcher.url=http://dcae.api.simpledemo.onap.org:8188
+clamp.config.dcae.dispatcher.retry.interval=10000
+clamp.config.dcae.dispatcher.retry.limit=10
clamp.config.dcae.header.requestId = X-ECOMP-RequestID
#Define user permission related parameters, the permission type can be changed but MUST be redefined in clds-users.properties in that case !
diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index 0d206cf6..b543af18 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -194,9 +194,13 @@ clamp.config.clds.service.cache.invalidate.after.seconds=120 #DCAE Inventory Url Properties
clamp.config.dcae.inventory.url=http://localhost:${docker.http-cache.port.host}
+clamp.config.dcae.intentory.retry.interval=10000
+clamp.config.dcae.intentory.retry.limit=3
#DCAE Dispatcher Url Properties
clamp.config.dcae.dispatcher.url=http://localhost:${docker.http-cache.port.host}
+clamp.config.dcae.dispatcher.retry.interval=10000
+clamp.config.dcae.dispatcher.retry.limit=10
clamp.config.dcae.header.requestId = X-ECOMP-RequestID
#Define user permission related parameters, the permission type can be changed but MUST be redefined in clds-users.properties in that case !
|