From f4817b420b59de111a0abe1eec761bd3e4458530 Mon Sep 17 00:00:00 2001 From: "Smokowski, Kevin (ks6305)" Date: Tue, 14 Aug 2018 14:43:31 +0000 Subject: dme2 & ueb support fix dme2 & ueb support in rest api call node Change-Id: Ia387c0be8e907900e0b808879582048624dbef36 Issue-ID: CCSDK-459 Signed-off-by: Smokowski, Kevin (ks6305) --- .../sli/plugins/restapicall/RestapiCallNode.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'restapi-call-node/provider/src/main/java') diff --git a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java index 42462f0e..46c74ff8 100644 --- a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java +++ b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java @@ -37,6 +37,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Properties; import java.util.Set; import javax.net.ssl.HostnameVerifier; @@ -75,6 +76,10 @@ public class RestapiCallNode implements SvcLogicJavaPlugin { private String uebServers; private String defaultUebTemplateFileName = "/opt/bvc/restapi/templates/default-ueb-message.json"; protected RetryPolicyStore retryPolicyStore; + protected static final String DME2_PROPERTIES_FILE_NAME = "dme2.properties"; + protected static final String UEB_PROPERTIES_FILE_NAME = "ueb.properties"; + protected static final String DEFAULT_PROPERTIES_DIR = "/opt/onap/ccsdk/data/properties"; + protected static final String PROPERTIES_DIR_KEY = "SDNC_CONFIG_DIR"; protected RetryPolicyStore getRetryPolicyStore() { return retryPolicyStore; @@ -85,7 +90,26 @@ public class RestapiCallNode implements SvcLogicJavaPlugin { } public RestapiCallNode() { + String configDir = System.getProperty(PROPERTIES_DIR_KEY, DEFAULT_PROPERTIES_DIR); + + try (FileInputStream in = new FileInputStream(configDir + "/" + DME2_PROPERTIES_FILE_NAME)) { + Properties props = new Properties(); + props.load(in); + this.retryPolicyStore = new RetryPolicyStore(); + this.retryPolicyStore.setProxyServers(props.getProperty("proxyUrl")); + log.info("DME2 support enabled"); + } catch (Exception e) { + log.warn("DME2 properties could not be read, DME2 support will not be enabled.", e); + } + try (FileInputStream in = new FileInputStream(configDir + "/" + UEB_PROPERTIES_FILE_NAME)) { + Properties props = new Properties(); + props.load(in); + this.uebServers = props.getProperty("servers"); + log.info("UEB support enabled"); + } catch (Exception e) { + log.warn("UEB properties could not be read, UEB support will not be enabled.", e); + } } /** -- cgit 1.2.3-korg