aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/main/java/org/onap
diff options
context:
space:
mode:
authorBonkur, Venkat (vb8416) <vb8416@att.com>2019-09-09 11:18:36 -0400
committerBonkur, Venkat (vb8416) <vb8416@att.com>2019-09-09 11:22:26 -0400
commitcf77e72ced2f815b3d011afcba17b91ae45d1858 (patch)
tree1115d91b755b98ec9b352a9a491dbddd469cca8a /asdc-controller/src/main/java/org/onap
parentf5f7d0763673dd0af81624eaa93b6951e1d299eb (diff)
Add SO Update Check if SDC activities deployment end point for custom worlflows is alive
Make changes to verify if SDC activities deployment end point(mso.asdc.config.activity.endpoint)  for custom worlflows is alive Issue-ID: SO-2294 Signed-off-by: Bonkur, Venkat (vb8416) <vb8416@att.com> Change-Id: Iff916a33b403d507a383cebf8d668bb5cbf9fb55
Diffstat (limited to 'asdc-controller/src/main/java/org/onap')
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
index 0fc94c8bd6..7f1c1968c1 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
@@ -20,6 +20,8 @@
package org.onap.so.asdc.activity;
+import java.net.HttpURLConnection;
+import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.onap.so.logger.LoggingAnchor;
@@ -27,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
+import org.apache.http.HttpStatus;
import org.onap.so.asdc.activity.beans.ActivitySpec;
import org.onap.so.asdc.activity.beans.Input;
import org.onap.so.asdc.activity.beans.Output;
@@ -59,6 +62,11 @@ public class DeployActivitySpecs {
String hostname = env.getProperty(SDC_ENDPOINT);
logger.debug("{} {}", "SDC ActivitySpec endpoint: ", hostname);
if (hostname == null || hostname.isEmpty()) {
+ logger.warn("The hostname for SDC activities deployment is not configured in SO");
+ return;
+ }
+ if (!checkHttpOk(hostname)) {
+ logger.warn("The sdc end point is not alive");
return;
}
List<org.onap.so.db.catalog.beans.ActivitySpec> activitySpecsFromCatalog = activitySpecRepository.findAll();
@@ -135,4 +143,22 @@ public class DeployActivitySpecs {
activitySpec.setOutputs(outputs);
return;
}
+
+ public boolean checkHttpOk(String host) {
+ URL url = null;
+ boolean isOk = false;
+
+ int responseCode = 0;
+ try {
+ url = new URL(host);
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ responseCode = connection.getResponseCode();
+ } catch (Exception e) {
+ logger.warn("Exception on connecting to SDC WFD endpoint: " + e.getMessage());
+ }
+ if (responseCode == HttpStatus.SC_OK) {
+ isOk = true;
+ }
+ return isOk;
+ }
}