From 1ad915ff0a4678d6a5f918f39ea42c18b620f7bb Mon Sep 17 00:00:00 2001 From: "Bonkur, Venkat (vb8416)" Date: Wed, 18 Sep 2019 02:22:37 -0400 Subject: Add SO Update Check if SDC activities deployment end point server Up for custom worlflows Make changes to verify if SDC activities deployment end point(mso.asdc.config.activity.endpoint) server up for custom workflows Issue-ID: SO-2348 Signed-off-by: Bonkur, Venkat (vb8416) Change-Id: I3b90b6d8e95681a685b23dfaa2f65596532e5b0e --- .../java/org/onap/so/asdc/activity/DeployActivitySpecs.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'asdc-controller/src/main/java') 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 7f1c1968c1..d60c377730 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 @@ -65,7 +65,7 @@ public class DeployActivitySpecs { logger.warn("The hostname for SDC activities deployment is not configured in SO"); return; } - if (!checkHttpOk(hostname)) { + if (!checkHttpServerUp(hostname)) { logger.warn("The sdc end point is not alive"); return; } @@ -144,21 +144,22 @@ public class DeployActivitySpecs { return; } - public boolean checkHttpOk(String host) { + public boolean checkHttpServerUp(String host) { URL url = null; - boolean isOk = false; + boolean isUp = false; int responseCode = 0; try { url = new URL(host); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setConnectTimeout(5000); responseCode = connection.getResponseCode(); } catch (Exception e) { logger.warn("Exception on connecting to SDC WFD endpoint: " + e.getMessage()); } - if (responseCode == HttpStatus.SC_OK) { - isOk = true; + if (responseCode == HttpStatus.SC_OK || responseCode == HttpStatus.SC_NOT_FOUND) { + isUp = true; } - return isOk; + return isUp; } } -- cgit 1.2.3-korg